Skip to content

OkCancelDialogAwareViewModel class

Base class for a dialog with the usual OK and Cancel buttons already wired up: OK closes the dialog with Ok, Cancel closes it with Cancel.

public abstract class OkCancelDialogAwareViewModel : DialogAwareViewModel

Public Members

name description
OkCancelDialogAwareViewModel() Initializes a new instance of the OkCancelDialogAwareViewModel class with an empty dialog caption.
OkCancelDialogAwareViewModel(…) Initializes a new instance of the OkCancelDialogAwareViewModel class with the given dialog caption.
CancelCommand { get; }
OkCommand { get; }
virtual Cancel(…) Handles the Cancel button. The base implementation closes the dialog with Cancel; override it to discard pending changes first.
virtual CanOk(…) Decides whether the OK button is enabled. Override it to require valid input before the dialog can be confirmed.
virtual Ok(…) Handles the OK button. The base implementation closes the dialog with Ok; override it to commit the entered data first, and skip the base call to keep the dialog open.

Remarks

Override Ok to validate or commit before closing, and CanOk to disable the OK button while the dialog is incomplete.

See Also