Skip to main content

UICommand Class

A ViewModel that generates a dialog button.

Namespace: DevExpress.Mvvm

Assembly: DevExpress.Mvvm.v25.1.dll

NuGet Packages: DevExpress.Mvvm, DevExpress.Win.Navigation

Declaration

public class UICommand :
    BindableBase,
    IUICommand

The following members return UICommand objects:

Show 22 links
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()
DXDialogWindow.ShowDialogWindow()
ThemedMessageBox.Show(IEnumerable<UICommand>, Window, String, UIElement, ImageSource, MessageBoxOptions, WindowStartupLocation, WindowTitleAlignment, Nullable<Boolean>)
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(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, ImageSource, MessageBoxOptions, WindowStartupLocation, WindowTitleAlignment, Nullable<Boolean>)
ThemedMessageBox.Show(String, IEnumerable<UICommand>, Window, String, MessageBoxImage, Boolean, 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)
ThemedMessageBox.Show(String, String, IEnumerable<UICommand>, ThemedMessageBoxParameters)
ThemedWindow.DialogButtonCommandResult
ThemedWindow.DialogButtonCommandResult
ThemedWindow.ShowDialog(IEnumerable<UICommand>)
ThemedWindow.ShowDialog(IEnumerable<UICommand>)
ThemedWindowDialogButton.UICommand
ThemedWindowDialogButton.UICommand

Remarks

The following example generates 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
);

View Example: How to: Use DialogService

Important

DXDialogWindow remains in our WPF suite for compatibility but lacks async UICommand support and other modern features. Use ThemedWindow instead.

Inheritance

See Also