Repository navigation
|
The sample codes show detect when adding Alarm and ColorLens.. How do I detect a cancel/close? [JSInvokable] |
Answered by
fgilde
Jun 15, 2024
Replies: 2 comments 2 replies
|
In general <MudDialog Class="mud-ex-dialog-initial">
<TitleContent>
<MudText Typo="Typo.h6">
<MudIcon Icon="@icon" Class="mr-3"/> @title
</MudText>
</TitleContent>
<DialogContent>
Dialog Content
<br/>
@ContentMessage
</DialogContent>
<DialogActions>
<MudButton OnClick="Cancel">Cancel</MudButton>
<MudButton Color="Color.Primary" OnClick="Submit">Ok</MudButton>
</DialogActions>
</MudDialog>
@code {
[CascadingParameter] MudDialogInstance MudDialog { get; set; }
[Parameter] public string ContentMessage { get; set; }
void Submit() => MudDialog.CloseAnimatedIf(DialogResult.Ok(true));
void Cancel() => MudDialog.CancelAnimatedIf();
}However from outside you just can access the result and check if it's canceled like this IMudExDialogReference<SampleDialog>? dlgReference = await DialogService.ShowEx<SampleDialog>("Simple Dialog", dialog => { dialog.ContentMessage = "Hello from dialog sample page"; }, options);
var res = await dlgReference.Result;
if (res.Canceled)
{
// canceled
} |
2 replies
Answer selected by
fgilde
|
Its done in 1.7.89 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

In general
ShowEx<YourDialog>()displays your dialog that means you internally have control about the result.