Back to Devexpress

ConfirmationBehavior.MessageButton Property

wpf-devexpress-dot-mvvm-dot-ui-dot-confirmationbehavior-4c34b939.md

latest2.2 KB
Original Source

ConfirmationBehavior.MessageButton Property

Gets or sets the confirmation message buttons. This is a dependency property.

Namespace : DevExpress.Mvvm.UI

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

NuGet Package : DevExpress.Wpf.Core

Declaration

csharp
public MessageBoxButton MessageButton { get; set; }
vb
Public Property MessageButton As MessageBoxButton

Property Value

TypeDefaultDescription
MessageBoxButton@System.Windows.MessageBoxButton.YesNo

Confirmation message buttons.

|

Remarks

The following code enables the Yes, No, and Cancel buttons in the confirmation message:

xaml
<Button Content="Close">
    <dxmvvm:Interaction.Behaviors>
        <dxmvvm:ConfirmationBehavior EnableConfirmationMessage="{Binding IsSaved, Converter={StaticResource BooleanNegationConverter}}" 
                                     Command="{Binding CloseCommand}" MessageText="The document has unsaved changes. Do you want to close the document?"/>
    </dxmvvm:Interaction.Behaviors>
</Button>
csharp
using DevExpress.Mvvm;
using DevExpress.Mvvm.DataAnnotations;
// ...
    public class MainViewModel : ViewModelBase {
    // ...
        [Command]
        public void Close() {
        // ...
        }
    }
vb
Imports DevExpress.Mvvm
Imports DevExpress.Mvvm.DataAnnotations
' ...
    Public Class MainViewModel
        Inherits ViewModelBase
        ' ...
        <Command>
        Public Sub Close()
        ' ...
        End Sub
    End Class

See Also

ConfirmationBehavior Class

ConfirmationBehavior Members

DevExpress.Mvvm.UI Namespace