Our WPF DialogService allows you to invoke a dialog window from the View Model code. The service's ShowDialog method accepts parameters that specify the window title, buttons, and so on. You can select buttons from the MessageButton
enumeration or create a collection of UICommand objects. This example demonstrates how to change the position of buttons generated from UICommand objects.
Dialog buttons are objects of the ThemedWindowDialogButton class. You can explicitly add these buttons to the dialog View:
- Create ThemedWindowDialogButton objects and define their properties.
- Add these objects to the
ThemedWindowDialogButtonsControl
container and specify its position. - Set the ThemedWindowOptions.UseCustomDialogFooter attached property to
true
to hide auto-generated buttons.
The ThemedWindowDialogButton class contains UICommand and DialogResult properties. These properties allow you to specify the value returned by the ShowDialog
method when a user clicks the button.
If you use dialog buttons from the MessageButton
enumeration, you can use the approach from the following example instead: WPF DialogService - Close an Opened Dialog and Specify the Dialog Result. This example demonstrates how to create a command that uses the CurrentDialogService to close the dialog with the specified result.
- MainView.xaml (VB: MainView.xaml)
- MainViewModel.cs (VB: MainViewModel.vb)
- DialogView.xaml (VB: DialogView.xaml)
- DialogViewModel.cs (VB: DialogViewModel.vb)
- DialogService
- ThemedWindowDialogButton
- UICommand
- Services in ViewModelBase Descendants
- CurrentDialogService
- Use DialogService to Show a Modal Dialog Window
- WPF DialogService - Close an Opened Dialog and Specify the Dialog Result
(you will be redirected to DevExpress.com to submit your response)