UICommand Class
A ViewModel that is used to generate a dialog button.
Namespace : DevExpress.Mvvm
Assembly :
DevExpress.Mvvm.v24.2.dll
NuGet Packages :
DevExpress.Mvvm , DevExpress.Win.Navigation
# Declaration
Public Class UICommand
Inherits BindableBase
Implements IUICommand
# Related API Members
The following members return UICommand objects:
Library
Related API Members
Cross-Platform Class Library
DialogServiceExtensions.ShowDialog(IDialogService, IEnumerable<UICommand>, String, Object)
DialogServiceExtensions.ShowDialog(IDialogService, IEnumerable<UICommand>, String, String, Object, Object)
DialogServiceExtensions.ShowDialog(IDialogService, IEnumerable<UICommand>, String, String, Object)
IDialogService.ShowDialog(IEnumerable<UICommand>, String, String, Object, Object, Object)
WPF Controls
DXDialogWindow.ShowDialogWindow()
ThemedMessageBox.Show(IEnumerable<UICommand>, Window, String, UIElement, ImageSource, MessageBoxOptions, WindowStartupLocation, WindowTitleAlignment, Nullable<Boolean>)
ThemedMessageBox.Show(IEnumerable<UICommand>, Window, String, UIElement, MessageBoxImage, Boolean, MessageBoxOptions, WindowStartupLocation, WindowTitleAlignment, Nullable<Boolean>)
ThemedMessageBox.Show(String, IEnumerable<UICommand>, Window, String, ImageSource, MessageBoxOptions, WindowStartupLocation, WindowTitleAlignment, Nullable<Boolean>)
ThemedMessageBox.Show(String, IEnumerable<UICommand>, Window, String, MessageBoxImage, Boolean, MessageBoxOptions, WindowStartupLocation, WindowTitleAlignment, Nullable<Boolean>)
ThemedMessageBox.Show(String, String, IEnumerable<UICommand>, ThemedMessageBoxParameters)
ThemedWindow.DialogButtonCommandResult
ThemedWindow.ShowDialog(IEnumerable<UICommand>)
ThemedWindowDialogButton.UICommand
The code sample below shows how to define dialog buttons:
UICommand registerCommand = new UICommand(
id: null ,
caption: "Register" ,
command: new DelegateCommand<CancelEventArgs>(
cancelArgs => {
try {
myExecuteMethod();
}
catch (Exception e) {
this .GetService<IMessageBoxService>().ShowMessage(e.Message, "Error" , MessageButton.OK);
cancelArgs.Cancel = true ;
}
},
cancelArgs => !string .IsNullOrEmpty(registrationViewModel.UserName)
),
isDefault: true ,
isCancel: false
);
UICommand cancelCommand = new UICommand(
id: MessageBoxResult.Cancel,
caption: "Cancel" ,
command: null ,
isDefault: false ,
isCancel: true
);
IDialogService service = this .GetService<IDialogService>(serviceName);
UICommand result = service.ShowDialog(
dialogCommands: new [] { registerCommand, cancelCommand },
title: "Registration Dialog" ,
viewModel: detailViewModel
);
Dim registerCommand As UICommand = New UICommand(
id:=Nothing ,
caption:="Register" ,
command:=New DelegateCommand(Of CancelEventArgs)(
Function (cancelArgs)
Try
myExecuteMethod()
Catch e As Exception
Me .GetService(Of IMessageBoxService)().ShowMessage(e.Message, "Error" , MessageButton.OK)
cancelArgs.Cancel = True
End Try
End Function ,
Function (cancelArgs)
Not String .IsNullOrEmpty(registrationViewModel.UserName)), isDefault:=True , isCancel:=False )
Dim cancelCommand As UICommand = New UICommand(
id:=MessageBoxResult.Cancel,
caption:="Cancel" ,
command:=Nothing ,
isDefault:=False ,
isCancel:=True )
Dim service As IDialogService = Me .GetService(Of IDialogService)(serviceName)
Dim result As UICommand =
service.ShowDialog(
dialogCommands:={registerCommand, cancelCommand},
title:="Registration Dialog" ,
viewModel:=detailViewModel)
View Example: How to: Use DialogService
See Also