1
votes

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!

2
Are you using the DataWindow or a custom implementation?Geert van Horrik
None, do I have to? Can I use this with the standard WPF window?Loetn

2 Answers

1
votes

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.

0
votes

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