I have used the BackdropClick = false in the Dialog options like that:
OpenDialogAsync(_maxWidth))" Variant="Variant.Filled" Color="Color.Primary">Add New Stock
@code { private readonly DialogOptions _maxWidth = new() { MaxWidth = MaxWidth.Medium, FullWidth = true, BackdropClick = false };
protected override void OnInitialized()
{
Console.WriteLine("Starter component loaded!");
}
private Task OpenDialogAsync(DialogOptions options)
{
var parameters = new DialogParameters<StockDialog>
{
{ x => x.ContentText, "Your computer seems very slow, click the download button to download free RAM." },
{ x => x.ButtonText, "Download" },
{ x => x.Color, Color.Info }
};
return DialogService.ShowAsync<StockDialog>("Custom Options Dialog", parameters, options);
}
}