DXDialogWindow.CommandsSource Property
Gets or sets a list of UICommand objects that are used to generate dialog buttons. This is a dependency property.
Namespace: DevExpress.Xpf.Core
Assembly: DevExpress.Xpf.Core.v20.2.dll
NuGet Packages: DevExpress.WindowsDesktop.Wpf.Core, DevExpress.Wpf.Core
Declaration
Property Value
Type | Description |
---|---|
IEnumerable<UICommand> | A list of UICommand objects that are used to generate dialog buttons. |
Remarks
The DXDialogWindow allows you to set custom dialog buttons. Follow the next steps to add a set of custom buttons to the DXDialogWindow:
- Pass a UICommand objects collection to the
DXDialogWindow.CommandsSource
. - Set the button’s UICommand.Tag property to a required MessageBoxResult Enum‘s value to set a Dialog Result returned when a user clicks this button.
The code example below demonstrates how to add custom dialog buttons to your window:
using DevExpress.Mvvm;
.....
public class MyDialogViewModel : IDialogViewModel {
public MyDialogViewModel() {
CommandsSource = new List<UICommand> {
new UICommand {
Id = System.Windows.MessageBoxResult.Cancel,
Caption = "Cancel",
IsCancel = true,
Tag = System.Windows.MessageBoxResult.Cancel
},
new UICommand {
Caption = "Print",
IsDefault = true,
Command = new DelegateCommand(Print),
Tag = System.Windows.MessageBoxResult.OK
}
};
}
See the UICommand topic to learn more.
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CommandsSource property.
Note
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.