Arne Van De Vyver
Arne Van De Vyver

Reputation: 83

How to close Catel Framework Datawindow from the viewmodel

Does anyone know how to close (or save) the data window from your viewmodel and not use the ok or cancel button but custom buttons like this:

public class UploadWindow : DataWindow
{
    public UploadWindow()
        : base(DataWindowMode.Custom)
    {
        AddCustomButton(new DataWindowButton("Ok", "???"));
        AddCustomButton(new DataWindowButton("Cancel", "???"));

        InitializeComponent();
    }
}

So i can do something extra before closing or saving other than the normal stuff. Thanks for the help!

Upvotes: 1

Views: 464

Answers (1)

Geert van Horrik
Geert van Horrik

Reputation: 5724

Inside the VM:

Option 1:

this.SaveAndCloseViewModelAsync();

Option 2:

this.CancelAndCloseViewModelAsync();

Upvotes: 2

Related Questions