Intersoft ClientUI 8 > ClientUI Fundamentals > Window and Dialog Boxes Overview > Window and Dialog Boxes How-to Topics > How-to: Create and Open a UXMessageBox using MVVM Pattern |
This example shows how to create and open a UXMessageBox using MVVM pattern.
You can display a desktop-like message box using MVVM pattern with the provided UXMessageBox API. You can show a message box using intuitive syntaxes that already common in general UI development such as using UXMessageBox.Show static method. You can use the MessageBoxServiceProvider to show the message box.
The following example shows how to show a UXMessageBox from ViewModel and handle the close callback.
C# |
Copy Code
|
---|---|
private void DeleteContact(object parameter) { MessageBoxServiceProvider.Show( "Are you sure you want to delete the selected contact?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question, (dialogResult) => { if (dialogResult == DialogResult.Yes) { ContactViewModel currentSelection = this.SelectedItem; this.SelectedItem = null; this.Contacts.Remove(currentSelection); } }); } |