Back to Devexpress

ConfirmationBehavior.MessageBoxService Property

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

latest2.7 KB
Original Source

ConfirmationBehavior.MessageBoxService Property

Gets or sets a custom message box service. You can use the WinUIMessageBox or create a custom message box that implements the IMessageBoxService interface. This is a dependency property.

Namespace : DevExpress.Mvvm.UI

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

NuGet Package : DevExpress.Wpf.Core

Declaration

csharp
public IMessageBoxService MessageBoxService { get; set; }
vb
Public Property MessageBoxService As IMessageBoxService

Property Value

TypeDescription
IMessageBoxService

A custom message box service.

|

Remarks

The following code sample enables a WinUIMessageBox in a ConfirmationBehavior:

xaml
<UserControl ... 
    xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
    xmlns:dxwui="http://schemas.devexpress.com/winfx/2008/xaml/windowsui">
    <Grid>
        <Button Content="Close">
            <dxmvvm:Interaction.Behaviors>
                <dxwui:WinUIMessageBoxService x:Name="winUIMessageBoxService"/>
                <dxmvvm:ConfirmationBehavior Command="{Binding CloseCommand}" 
                MessageText="Do you want to close the document and lose unsaved changes?"
                MessageBoxService="{Binding ElementName=winUIMessageBoxService}">
                </dxmvvm:ConfirmationBehavior>
            </dxmvvm:Interaction.Behaviors>
        </Button>
    </Grid>
</UserControl>
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