Interface IDialogService
- Namespace
- MudBlazor
- Assembly
- MudBlazor.dll
A service for managing MudDialog components.
public interface IDialogService
- Extension Methods
Remarks
This service requires a MudDialogProvider in your layout page.
Methods
Close(IDialogReference)
Hides an existing dialog.
void Close(IDialogReference dialog)
Parameters
dialog
IDialogReferenceThe reference of the dialog to hide.
Close(IDialogReference, DialogResult?)
Hides an existing dialog.
void Close(IDialogReference dialog, DialogResult? result)
Parameters
dialog
IDialogReferenceThe reference of the dialog to hide.
result
DialogResultThe result to include.
CreateReference()
Creates a reference to a dialog.
IDialogReference CreateReference()
Returns
- IDialogReference
The dialog reference.
Show(Type)
Displays a dialog.
[Obsolete("Use ShowAsync instead. This will be removed in future major version.")]
IDialogReference Show(Type component)
Parameters
component
TypeThe type of dialog to display.
Returns
- IDialogReference
A reference to the dialog.
Show(Type, string?)
Displays a dialog with a custom title.
[Obsolete("Use ShowAsync instead. This will be removed in future major version.")]
IDialogReference Show(Type component, string? title)
Parameters
Returns
- IDialogReference
A reference to the dialog.
Show(Type, string?, DialogOptions)
Displays a dialog with a custom title and options.
[Obsolete("Use ShowAsync instead. This will be removed in future major version.")]
IDialogReference Show(Type component, string? title, DialogOptions options)
Parameters
component
TypeThe type of dialog to display.
title
stringThe text at the top of the dialog.
options
DialogOptionsThe custom display options for the dialog.
Returns
- IDialogReference
A reference to the dialog.
Show(Type, string?, DialogParameters)
Displays a dialog with a custom title and options.
[Obsolete("Use ShowAsync instead. This will be removed in future major version.")]
IDialogReference Show(Type component, string? title, DialogParameters parameters)
Parameters
component
TypeThe type of dialog to display.
title
stringThe text at the top of the dialog.
parameters
DialogParametersThe custom parameters to set within the dialog.
Returns
- IDialogReference
A reference to the dialog.
Show(Type, string?, DialogParameters, DialogOptions)
Displays a dialog with a custom title, parameters, and options.
[Obsolete("Use ShowAsync instead. This will be removed in future major version.")]
IDialogReference Show(Type component, string? title, DialogParameters parameters, DialogOptions options)
Parameters
component
TypeThe type of dialog to display.
title
stringThe text at the top of the dialog.
parameters
DialogParametersThe custom parameters to set within the dialog.
options
DialogOptionsThe custom display options for the dialog.
Returns
- IDialogReference
A reference to the dialog.
ShowAsync(Type)
Displays a dialog.
Task<IDialogReference> ShowAsync(Type component)
Parameters
component
TypeThe dialog to display.
Returns
- Task<IDialogReference>
A reference to the dialog.
ShowAsync(Type, string?)
Displays a dialog with a custom title.
Task<IDialogReference> ShowAsync(Type component, string? title)
Parameters
Returns
- Task<IDialogReference>
A reference to the dialog.
ShowAsync(Type, string?, DialogOptions)
Displays a dialog with a custom title and options.
Task<IDialogReference> ShowAsync(Type component, string? title, DialogOptions options)
Parameters
component
TypeThe dialog to display.
title
stringThe text at the top of the dialog.
options
DialogOptionsThe custom display options for the dialog.
Returns
- Task<IDialogReference>
A reference to the dialog.
ShowAsync(Type, string?, DialogParameters)
Displays a dialog with a custom title and parameters.
Task<IDialogReference> ShowAsync(Type component, string? title, DialogParameters parameters)
Parameters
component
TypeThe dialog to display.
title
stringThe text at the top of the dialog.
parameters
DialogParametersThe custom parameters to set within the dialog.
Returns
- Task<IDialogReference>
A reference to the dialog.
ShowAsync(Type, string?, DialogParameters, DialogOptions)
Displays a dialog with a custom title, parameters, and options.
Task<IDialogReference> ShowAsync(Type component, string? title, DialogParameters parameters, DialogOptions options)
Parameters
component
TypeThe dialog to display.
title
stringThe text at the top of the dialog.
parameters
DialogParametersThe custom parameters to set within the dialog.
options
DialogOptionsThe custom display options for the dialog.
Returns
- Task<IDialogReference>
A reference to the dialog.
ShowAsync<TComponent>()
Displays a dialog.
Task<IDialogReference> ShowAsync<TComponent>() where TComponent : IComponent
Returns
- Task<IDialogReference>
A reference to the dialog.
Type Parameters
TComponent
The dialog to display.
ShowAsync<TComponent>(string?)
Displays a dialog with a custom title.
Task<IDialogReference> ShowAsync<TComponent>(string? title) where TComponent : IComponent
Parameters
title
stringThe text at the top of the dialog.
Returns
- Task<IDialogReference>
A reference to the dialog.
Type Parameters
TComponent
The dialog to display.
ShowAsync<TComponent>(string?, DialogOptions)
Displays a dialog with a custom title and options.
Task<IDialogReference> ShowAsync<TComponent>(string? title, DialogOptions options) where TComponent : IComponent
Parameters
title
stringThe text at the top of the dialog.
options
DialogOptionsThe custom display options for the dialog.
Returns
- Task<IDialogReference>
A reference to the dialog.
Type Parameters
TComponent
The dialog to display.
ShowAsync<TComponent>(string?, DialogParameters)
Displays a dialog with a custom title and parameters.
Task<IDialogReference> ShowAsync<TComponent>(string? title, DialogParameters parameters) where TComponent : IComponent
Parameters
title
stringThe text at the top of the dialog.
parameters
DialogParametersThe custom parameters to set within the dialog.
Returns
- Task<IDialogReference>
A reference to the dialog.
Type Parameters
TComponent
The dialog to display.
ShowAsync<TComponent>(string?, DialogParameters, DialogOptions?)
Displays a dialog with a custom title, parameters, and options.
Task<IDialogReference> ShowAsync<TComponent>(string? title, DialogParameters parameters, DialogOptions? options) where TComponent : IComponent
Parameters
title
stringThe text at the top of the dialog.
parameters
DialogParametersThe custom parameters to set within the dialog.
options
DialogOptionsThe custom display options for the dialog.
Returns
- Task<IDialogReference>
A reference to the dialog.
Type Parameters
TComponent
The dialog to display.
ShowMessageBox(MessageBoxOptions, DialogOptions?)
Shows a simple dialog with custom options.
Task<bool?> ShowMessageBox(MessageBoxOptions messageBoxOptions, DialogOptions? options = null)
Parameters
messageBoxOptions
MessageBoxOptionsThe options for the message box.
options
DialogOptionsThe custom display options for the dialog. Defaults to
null
.
Returns
- Task<bool?>
Returns
null
if theCancel
button was clicked,true
if theYes
button was clicked, orfalse
if theNo
button was clicked.
ShowMessageBox(string?, MarkupString, string, string?, string?, DialogOptions?)
Shows a simple dialog with a title, HTML message, and up to three custom buttons.
Task<bool?> ShowMessageBox(string? title, MarkupString markupMessage, string yesText = "OK", string? noText = null, string? cancelText = null, DialogOptions? options = null)
Parameters
title
stringThe text at the top of the dialog.
markupMessage
MarkupStringThe HTML message displayed under the title.
yesText
stringThe text of the "Yes" button. Defaults to
OK
.noText
stringThe text of the "No" button. Defaults to
null
.cancelText
stringThe text of the "Cancel" button. Defaults to
null
.options
DialogOptionsThe custom display options for the dialog. Defaults to
null
.
Returns
- Task<bool?>
Returns
null
if theCancel
button was clicked,true
if theYes
button was clicked, orfalse
if theNo
button was clicked.
ShowMessageBox(string?, string, string, string?, string?, DialogOptions?)
Shows a simple dialog with a title, message, and up to three custom buttons.
Task<bool?> ShowMessageBox(string? title, string message, string yesText = "OK", string? noText = null, string? cancelText = null, DialogOptions? options = null)
Parameters
title
stringThe text at the top of the dialog.
message
stringThe message displayed under the title.
yesText
stringThe text of the "Yes" button. Defaults to
OK
.noText
stringThe text of the "No" button. Defaults to
null
.cancelText
stringThe text of the "Cancel" button. Defaults to
null
.options
DialogOptionsThe custom display options for the dialog. Defaults to
null
.
Returns
- Task<bool?>
Returns
null
if theCancel
button was clicked,true
if theYes
button was clicked, orfalse
if theNo
button was clicked.
Show<TComponent>()
Displays a dialog.
[Obsolete("Use ShowAsync instead. This will be removed in future major version.")]
IDialogReference Show<TComponent>() where TComponent : IComponent
Returns
- IDialogReference
A reference to the dialog.
Type Parameters
TComponent
The type of dialog to display.
Show<TComponent>(string?)
Displays a dialog with a custom title.
[Obsolete("Use ShowAsync instead. This will be removed in future major version.")]
IDialogReference Show<TComponent>(string? title) where TComponent : IComponent
Parameters
title
stringThe text at the top of the dialog.
Returns
- IDialogReference
A reference to the dialog.
Type Parameters
TComponent
The type of dialog to display.
Show<TComponent>(string?, DialogOptions)
Displays a dialog with a custom title and options.
[Obsolete("Use ShowAsync instead. This will be removed in future major version.")]
IDialogReference Show<TComponent>(string? title, DialogOptions options) where TComponent : IComponent
Parameters
title
stringThe text at the top of the dialog.
options
DialogOptionsThe custom display options for the dialog.
Returns
- IDialogReference
A reference to the dialog.
Type Parameters
TComponent
The type of dialog to display.
Show<TComponent>(string?, DialogParameters)
Displays a dialog with custom parameters.
[Obsolete("Use ShowAsync instead. This will be removed in future major version.")]
IDialogReference Show<TComponent>(string? title, DialogParameters parameters) where TComponent : IComponent
Parameters
title
stringThe text at the top of the dialog.
parameters
DialogParametersThe custom parameters to set within the dialog.
Returns
- IDialogReference
A reference to the dialog.
Type Parameters
TComponent
The type of dialog to display.
Show<TComponent>(string?, DialogParameters, DialogOptions?)
Displays a dialog with custom options and parameters.
[Obsolete("Use ShowAsync instead. This will be removed in future major version.")]
IDialogReference Show<TComponent>(string? title, DialogParameters parameters, DialogOptions? options) where TComponent : IComponent
Parameters
title
stringThe text at the top of the dialog.
parameters
DialogParametersThe custom parameters to set within the dialog.
options
DialogOptionsThe custom display options for the dialog.
Returns
- IDialogReference
A reference to the dialog.
Type Parameters
TComponent
Events
DialogInstanceAddedAsync
Occurs when a new dialog instance is created.
event Func<IDialogReference, Task> DialogInstanceAddedAsync
Event Type
OnDialogCloseRequested
Occurs when a request is made to close a dialog.
event Action<IDialogReference, DialogResult?>? OnDialogCloseRequested