MessageBoxService Class
In This Article
The UI service that allows you to show messages.
Namespace: DevExpress.WinUI.Core
Assembly: DevExpress.WinUI.Core.v23.2.dll
NuGet Package: DevExpress.WinUI
#Declaration
public class MessageBoxService :
UIServiceBase,
IMessageBoxService,
IMessageButtonLocalizer
#Remarks
The following code sample shows a message when a user clicks the Button:
<UserControl ...
xmlns:dx="using:DevExpress.WinUI.Core"
xmlns:ViewModel="using:WinUIApp.ViewModel">
<UserControl.DataContext>
<ViewModel:ViewModel/>
</UserControl.DataContext>
<dx:Interaction.Behaviors>
<dx:MessageBoxService/>
</dx:Interaction.Behaviors>
<!-- ... -->
<Button Content="Save" Command="{x:Bind SaveCommand}"/>
</UserControl>
public class ViewModel : ViewModelBase {
public DelegateCommand SaveCommand { get; }
IMessageBoxService MessageBoxService => GetUIService<IMessageBoxService>();
public ViewModel() {
SaveCommand = new DelegateCommand(() => Save());
}
public async void Save() {
MessageResult result = await MessageBoxService.ShowAsync(
content: "Are you sure you want to save?",
title: "Confirmation",
button: MessageButton.OKCancel);
if(result == MessageResult.OK) {
//...
} else {
//...
}
}
}
#Implements
#Inheritance
See Also