wpf-devexpress-dot-mvvm-dot-ui-dot-confirmationbehavior.md
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
public IMessageBoxService MessageBoxService { get; set; }
Public Property MessageBoxService As IMessageBoxService
| Type | Description |
|---|---|
| IMessageBoxService |
A custom message box service.
|
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() {
// ...
}
}
Imports DevExpress.Mvvm
Imports DevExpress.Mvvm.DataAnnotations
Public Class MainViewModel
Inherits ViewModelBase
<Command>
Public Sub Close()
End Sub
End Class
See Also