Skip to main content
All docs
V24.1

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.v24.1.dll

NuGet Package: DevExpress.Wpf.Core

Declaration

public IMessageBoxService MessageBoxService { get; set; }

Property Value

Type Description
IMessageBoxService

A custom message box service.

Remarks

The following code sample enables a WinUIMessageBox in a ConfirmationBehavior:

<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>
using DevExpress.Mvvm;
using DevExpress.Mvvm.DataAnnotations;

public class MainViewModel : ViewModelBase {
    [Command]
    public void Close() {
        // ...
    }
}
See Also