Skip to main content

UICommand Class

A ViewModel that is used to generate a dialog button.

Namespace: DevExpress.Mvvm

Assembly: DevExpress.Mvvm.v22.1.dll


public class 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 {
            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

The following code snippets (auto-collected from DevExpress Examples) contain references to the UICommand class.


The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.


See Also