Loetn
Loetn

Reputation: 4040

Close window with Catel

I'm using Catel as my MVVM framework to develop a WPF application.

I open my window via the UIVisualizerService, provided by Catel, like this:

this.uiVisualizerService.ShowDialog(new ViewModel);

This works perfectly. The problem is that I can't close my window with, like said on the Catel website

this.CloseViewModel(true);

When I click the cancel button, the command is executed, but nothing happens.

More info:

My window code-behind class:

public partial class Window : Window
{
    public Window()
    {
        this.InitializeComponent();
    }
}

My Cancel button:

<Button Command="{Binding CancelCommand}" />

My command method in my viewmodel:

 private void CancelCommandExecuted()
    {
        this.CloseViewModel(true);
    }

Thanks in advance!

Upvotes: 1

Views: 1960

Answers (2)

Loetn
Loetn

Reputation: 4040

I solved this problem using https://catelproject.atlassian.net/wiki/display/CTL/MVVM+behaviors#MVVMbehaviors-WindowBehavior

Now I have a normal WPF window that I can close with Catel.

Upvotes: 1

Geert van Horrik
Geert van Horrik

Reputation: 5724

This issue is fixed in the latest nightly build.

For more information about the issue: https://catelproject.atlassian.net/browse/CTL-158

For more information about getting the latest nightly build: https://catelproject.atlassian.net/wiki/display/CTL/Getting+prerelease+%28beta%29+versions+via+NuGet

Upvotes: 0

Related Questions