Back to Devexpress

ThemedWindow.DialogButtons Property

wpf-devexpress-dot-xpf-dot-core-dot-themedwindow-461e7bfd.md

latest4.7 KB
Original Source

ThemedWindow.DialogButtons Property

Gets the custom dialog button collection. This is a dependency property.

Namespace : DevExpress.Xpf.Core

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

NuGet Package : DevExpress.Wpf.Core

Declaration

csharp
public ObservableCollection<object> DialogButtons { get; }
vb
Public ReadOnly Property DialogButtons As ObservableCollection(Of Object)

Property Value

TypeDescription
ObservableCollection<Object>

A dialog button collection.

|

Remarks

Create a ThemedWindowDialogButton object and add it to the DialogButtons collection to display a custom button.

You should specify the dialog button’s DialogResult property.

The following code sample shows how to add the OK and Cancel buttons to the ThemedWindow in code:

csharp
ThemedWindow themedWindow = new ThemedWindow() { Title = "Your update is ready" };
themedWindow.Content = new TextBlock() { Text = "Do you want to update now?" };

ThemedWindowDialogButton DismissDialogButton = new ThemedWindowDialogButton() { Content = "Remind Me Tomorrow", DialogResult = MessageBoxResult.No, Placement = Dock.Left };
themedWindow.DialogButtons.Add(DismissDialogButton);

MessageBoxResult result = themedWindow.ShowDialog(MessageBoxButton.OKCancel);

ThemedMessageBox.Show("Done", String.Format("'{0}' dialogButton has been pressed", result.ToString()), MessageBoxButton.OK);
vb
Private Sub SurroundingSub()
    Dim themedWindow As ThemedWindow = New ThemedWindow() With {
        .Title = "Your update is ready"
    }
    Dim themedWindow.Content = New TextBlock() With {
        .Text = "Do you want to update now?"
    }
    Dim DismissDialogButton As ThemedWindowDialogButton = New ThemedWindowDialogButton() With {
        .Content = "Remind Me Tomorrow",
        .DialogResult = MessageBoxResult.No,
        .Placement = Dock.Left
    }
    themedWindow.DialogButtons.Add(DismissDialogButton)

    Dim result As MessageBoxResult = themedWindow.ShowDialog(MessageBoxButton.OKCancel)

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

The image below illustrates the result:

The following code sample shows how to add the same buttons to the ThemedWindow in XAML:

xaml
<dx:ThemedWindow ...
    xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core">
    <dx:ThemedWindow.DialogButtons>
        <dx:ThemedWindowDialogButton Content="Remind Me Tomorrow" Placement="Left" DialogResult="No"/>
        <dx:ThemedWindowDialogButton DialogResult="OK" Content="OK" IsDefault="True"/>
        <dx:ThemedWindowDialogButton DialogResult="Cancel" Content="Cancel"/>
    </dx:ThemedWindow.DialogButtons>
</dx:ThemedWindow>

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the DialogButtons 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.

wpf-scheduler-specify-custom-edit-and-recurrence-dialogs/CS/CustomMvvmFormWithRecurrenceExample/HospitalRecurrenceWindow.xaml#L55

xml
</Grid>
<dx:ThemedWindow.DialogButtons>
    <dx:ThemedWindowDialogButton Content="{dxsch:SchedulerLocalizer StringId=ButtonCaption_OK}" Command="{Binding SaveCommand}" IsDefault="True" MinWidth="65" DialogResult="OK"/>

See Also

ThemedWindow Class

ThemedWindow Members

DevExpress.Xpf.Core Namespace