Back to Devexpress

ThemedWindow.ShowDialog(IEnumerable<UICommand>) Method

wpf-devexpress-dot-xpf-dot-core-dot-themedwindow-dot-showdialog-x28-system-dot-collections-dot-generic-dot-ienumerable-devexpress-dot-mvvm-dot-uicommand-x29.md

latest3.3 KB
Original Source

ThemedWindow.ShowDialog(IEnumerable<UICommand>) Method

Displays the ThemedWindowDialog. A result returned when the window is closed.

Namespace : DevExpress.Xpf.Core

Assembly : DevExpress.Xpf.Core.v25.2.dll

NuGet Package : DevExpress.Wpf.Core

Declaration

csharp
public UICommand ShowDialog(
    IEnumerable<UICommand> dialogButtons = null
)
vb
Public Function ShowDialog(
    dialogButtons As IEnumerable(Of UICommand) = Nothing
) As UICommand

Optional Parameters

NameTypeDefaultDescription
dialogButtonsIEnumerable<UICommand>null

A UICommand collection.

|

Returns

TypeDescription
UICommand

A clicked button’s UICommand value.

|

Remarks

The following code snippet shows how to display the ThemedWindow with a UICommand list and check the pressed button:

csharp
ThemedWindow themedWindow = new ThemedWindow() { Title = "ThemedWindowDialog" };

List<UICommand> buttons = new List<UICommand>();         
buttons.Add(new UICommand() { Id = MessageBoxResult.Cancel, Caption = "Custom_Cancel", IsCancel = true });
buttons.Add(new UICommand() { Id = MessageBoxResult.OK, Caption = "Custom_Ok", IsDefault = true });    
buttons.Add(new UICommand() { Id = MessageBoxResult.Yes, Caption = "Apply", Placement = Dock.Left });
buttons.Add(new UICommand() { Id = MessageBoxResult.No, Caption = "Dismiss", Placement = Dock.Left });

UICommand result = themedWindow.ShowDialog(buttons);

ThemedMessageBox.Show("Done", String.Format("'{0}' dialogButton has been pressed", result.Id.ToString()), MessageBoxButton.OK);
vb
Dim themedWindow As ThemedWindow = New ThemedWindow() With {
      .Title = "ThemedWindowDialog" }

Dim buttons As List(Of UICommand) = New List(Of UICommand)()  
buttons.Add(New UICommand() With{ 
  .Id = MessageBoxResult.Cancel, 
  .Caption = "Custom_Cancel", 
  .IsCancel = true })
buttons.Add(New UICommand() With{ 
  .Id = MessageBoxResult.OK, 
  .Caption = "Custom_Ok", 
  .IsDefault = true })
buttons.Add(New UICommand() With{ 
  .Id = MessageBoxResult.OK, 
  .Caption = "Apply", 
  .Placement = Dock.Left })
buttons.Add(New UICommand() With{ 
  .Id = MessageBoxResult.Cancel, 
  .Caption = "Dismiss", 
  .Placement = Dock.Left })

Dim result As UICommand = themedWindow.ShowDialog(buttons)

ThemedMessageBox.Show("Done", String.Format("'{0}' dialogButton has been pressed", result.Id.ToString()), MessageBoxButton.OK)

See Also

ThemedWindow Class

ThemedWindow Members

DevExpress.Xpf.Core Namespace