The DevExpress Blazor Message Box component allows you to display alert or confirmation dialogs in your application.
You can place the component in markup and display it on demand or use the dialog service (IDialogService) to create message boxes at runtime (see the Dialog Service demo).
In this demo, the DxMessageBox component is declared in markup. The Visible property controls message box visibility. Implement two-way binding for the property to display and close the message box in code. When a user clicks the demo area, the property is set to true and the message box appears on-screen. When a user closes the dialog, the component updates the Visible
property value accordingly.
The Message Box component can display alert and confirmation dialogs. Use the Type property to specify message box type:
Alert
– a dialog that displays an OK button.Confirmation
– a dialog that displays OK and Cancel buttons.
To configure message box appearance, specify RenderStyle and ThemeMode properties. The component supports Light
and Dark
theme modes and the following render styles:
Danger
Info
Primary
Success
Warning
You can combine these settings to customize message box appearance as needed.
Our Blazor Message Box component (DxMessageBox) can be closed in the following manner:
- Click the OK or Cancel button.
- Click the Close button in the header. Set the ShowCloseButton property to
false
to hide the Close button. - Press Escape. Set the CloseOnEscape property to
false
to disable this option. - Click outside message box boundaries. Set the CloseOnOutsideClick property to
true
to enable this option.
RESULT: No result
Our Blazor Message Box Dialog Service allows you to create and display dialogs (DxMessageBox objects) in code. To use the service, inject it with the Inject
attribute and declare a DxDialogProvider object on the page. Call methods implemented by the IDialogService interface to create alert and confirmation dialogs:
- AlertAsync creates and displays an alert dialog with an OK button.
- ConfirmAsync creates and displays a confirmation dialog with OK and Cancel buttons.