Reputation: 179
The backdrop click can be disabled with MudBlazor dialog. But how to run a Task when clicking on the backdrop?
Upvotes: 0
Views: 448
Reputation: 4967
You have to use the OnBackdropClick
EventCallback.
For this to work the DisableBackdropClick
option should Not be true. However if you implement your own logic/Task when backdrop is clicked, this will override the default logic for backdrop click, which is to close/cancel the dialog.
<MudDialog OnBackdropClick="@HandleBackdropClick">
<TitleContent>
<p>Times backdrop clicked: @timesBackDropClicked</p>
</TitleContent>
</MudDialog>
@code {
[CascadingParameter] MudDialogInstance MudDialog { get; set; }
int timesBackDropClicked;
void HandleBackdropClick(MouseEventArgs eArgs)
{
timesBackDropClicked++;
}
}
Upvotes: 0