This example demonstrates how to display a custom message in place of the default user warning dialog box.
Create a class that implements the IMessageBox service and use the SpreadsheetControl.ReplaceService method to register this class in place of the default service. Note that due to WPF Spreadsheet implementation specifics, it is necessary to replace the built-in service after the control is completely loaded.
The IMessageBox service provides the ShowMessage, ShowOkCancelMessage, ShowYesNoCancelMessage, ShowYesNoMessage, and ShowDataValidationDialog methods that are called when the SpreadsheetControl needs user attention.
CS | VB |
---|---|
MainWindow.xaml | MainWindow.xaml |
MainWindow.xaml.cs | MainWindow.xaml.vb |
MyMessageBoxService.cs | MyMessageBoxService.vb |