Reputation: 179
Is it possible to prevent closing the MudBlazor dialog when clicking on the overlay (outside the dialog)? Or to run a Task when clicking on the overlay?
Upvotes: 2
Views: 2093
Reputation: 167
To prevent closing the dialog when clicking on the overlay, you need to set DisableBackdropClick = true
For example:
@inject IDialogService DialogService
<MudButton OnClick="@((e) => OpenDialog())"
Variant="Variant.Filled"
Color="Color.Primary">Show Dialog</MudButton>
@code
{
private void OpenDialog()
{
DialogOptions options = new DialogOptions() { DisableBackdropClick = true };
DialogService.Show<DialogUsageExample_Dialog>("Custom Options", options);
}
}
Upvotes: 8