Class DialogService
- Namespace
- MudBlazor
- Assembly
- MudBlazor.dll
A service for managing MudDialog components.
public class DialogService : IDialogService
- Inheritance
-
DialogService
- Implements
- Inherited Members
- Extension Methods
Remarks
This service requires a MudDialogProvider in your layout page.
Constructors
DialogService()
public DialogService()
Methods
Close(IDialogReference)
Hides an existing dialog.
public void Close(IDialogReference dialog)
Parameters
dialogIDialogReferenceThe reference of the dialog to hide.
Close(IDialogReference, DialogResult?)
Hides an existing dialog.
public virtual void Close(IDialogReference dialog, DialogResult? result)
Parameters
dialogIDialogReferenceThe reference of the dialog to hide.
resultDialogResultThe result to include.
CreateReference()
Creates a reference to a dialog.
public virtual IDialogReference CreateReference()
Returns
- IDialogReference
The dialog reference.
Show(Type)
Displays a dialog.
[Obsolete("Use ShowAsync instead. This will be removed in future major version.")]
public IDialogReference Show(Type contentComponent)
Parameters
contentComponentType
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.")]
public IDialogReference Show(Type contentComponent, 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.")]
public IDialogReference Show(Type contentComponent, string? title, DialogOptions options)
Parameters
contentComponentTypetitlestringThe text at the top of the dialog.
optionsDialogOptionsThe 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.")]
public IDialogReference Show(Type contentComponent, string? title, DialogParameters parameters)
Parameters
contentComponentTypetitlestringThe text at the top of the dialog.
parametersDialogParametersThe 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.")]
public IDialogReference Show(Type contentComponent, string? title, DialogParameters parameters, DialogOptions options)
Parameters
contentComponentTypetitlestringThe text at the top of the dialog.
parametersDialogParametersThe custom parameters to set within the dialog.
optionsDialogOptionsThe custom display options for the dialog.
Returns
- IDialogReference
A reference to the dialog.
ShowAsync(Type)
Displays a dialog.
public Task<IDialogReference> ShowAsync(Type contentComponent)
Parameters
contentComponentType
Returns
- Task<IDialogReference>
A reference to the dialog.
ShowAsync(Type, string?)
Displays a dialog with a custom title.
public Task<IDialogReference> ShowAsync(Type contentComponent, string? title)
Parameters
Returns
- Task<IDialogReference>
A reference to the dialog.
ShowAsync(Type, string?, DialogOptions)
Displays a dialog with a custom title and options.
public Task<IDialogReference> ShowAsync(Type contentComponent, string? title, DialogOptions options)
Parameters
contentComponentTypetitlestringThe text at the top of the dialog.
optionsDialogOptionsThe 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.
public Task<IDialogReference> ShowAsync(Type contentComponent, string? title, DialogParameters parameters)
Parameters
contentComponentTypetitlestringThe text at the top of the dialog.
parametersDialogParametersThe 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.
public Task<IDialogReference> ShowAsync(Type contentComponent, string? title, DialogParameters parameters, DialogOptions options)
Parameters
contentComponentTypetitlestringThe text at the top of the dialog.
parametersDialogParametersThe custom parameters to set within the dialog.
optionsDialogOptionsThe custom display options for the dialog.
Returns
- Task<IDialogReference>
A reference to the dialog.
ShowAsync<T>()
Displays a dialog.
public Task<IDialogReference> ShowAsync<T>() where T : IComponent
Returns
- Task<IDialogReference>
A reference to the dialog.
Type Parameters
T
ShowAsync<T>(string?)
Displays a dialog with a custom title.
public Task<IDialogReference> ShowAsync<T>(string? title) where T : IComponent
Parameters
titlestringThe text at the top of the dialog.
Returns
- Task<IDialogReference>
A reference to the dialog.
Type Parameters
T
ShowAsync<T>(string?, DialogOptions)
Displays a dialog with a custom title and options.
public Task<IDialogReference> ShowAsync<T>(string? title, DialogOptions options) where T : IComponent
Parameters
titlestringThe text at the top of the dialog.
optionsDialogOptionsThe custom display options for the dialog.
Returns
- Task<IDialogReference>
A reference to the dialog.
Type Parameters
T
ShowAsync<T>(string?, DialogParameters)
Displays a dialog with a custom title and parameters.
public Task<IDialogReference> ShowAsync<T>(string? title, DialogParameters parameters) where T : IComponent
Parameters
titlestringThe text at the top of the dialog.
parametersDialogParametersThe custom parameters to set within the dialog.
Returns
- Task<IDialogReference>
A reference to the dialog.
Type Parameters
T
ShowAsync<T>(string?, DialogParameters, DialogOptions?)
Displays a dialog with a custom title, parameters, and options.
public Task<IDialogReference> ShowAsync<T>(string? title, DialogParameters parameters, DialogOptions? options) where T : IComponent
Parameters
titlestringThe text at the top of the dialog.
parametersDialogParametersThe custom parameters to set within the dialog.
optionsDialogOptionsThe custom display options for the dialog.
Returns
- Task<IDialogReference>
A reference to the dialog.
Type Parameters
T
ShowMessageBox(MessageBoxOptions, DialogOptions?)
Shows a simple dialog with custom options.
public Task<bool?> ShowMessageBox(MessageBoxOptions messageBoxOptions, DialogOptions? options = null)
Parameters
messageBoxOptionsMessageBoxOptionsThe options for the message box.
optionsDialogOptionsThe custom display options for the dialog. Defaults to
null.
Returns
- Task<bool?>
Returns
nullif theCancelbutton was clicked,trueif theYesbutton was clicked, orfalseif theNobutton was clicked.
ShowMessageBox(string?, MarkupString, string, string?, string?, DialogOptions?)
Shows a simple dialog with a title, HTML message, and up to three custom buttons.
public Task<bool?> ShowMessageBox(string? title, MarkupString markupMessage, string yesText = "OK", string? noText = null, string? cancelText = null, DialogOptions? options = null)
Parameters
titlestringThe text at the top of the dialog.
markupMessageMarkupStringThe HTML message displayed under the title.
yesTextstringThe text of the "Yes" button. Defaults to
OK.noTextstringThe text of the "No" button. Defaults to
null.cancelTextstringThe text of the "Cancel" button. Defaults to
null.optionsDialogOptionsThe custom display options for the dialog. Defaults to
null.
Returns
- Task<bool?>
Returns
nullif theCancelbutton was clicked,trueif theYesbutton was clicked, orfalseif theNobutton was clicked.
ShowMessageBox(string?, string, string, string?, string?, DialogOptions?)
Shows a simple dialog with a title, message, and up to three custom buttons.
public Task<bool?> ShowMessageBox(string? title, string message, string yesText = "OK", string? noText = null, string? cancelText = null, DialogOptions? options = null)
Parameters
titlestringThe text at the top of the dialog.
messagestringThe message displayed under the title.
yesTextstringThe text of the "Yes" button. Defaults to
OK.noTextstringThe text of the "No" button. Defaults to
null.cancelTextstringThe text of the "Cancel" button. Defaults to
null.optionsDialogOptionsThe custom display options for the dialog. Defaults to
null.
Returns
- Task<bool?>
Returns
nullif theCancelbutton was clicked,trueif theYesbutton was clicked, orfalseif theNobutton was clicked.
Show<T>()
Displays a dialog.
[Obsolete("Use ShowAsync instead. This will be removed in future major version.")]
public IDialogReference Show<T>() where T : IComponent
Returns
- IDialogReference
A reference to the dialog.
Type Parameters
T
Show<T>(string?)
Displays a dialog with a custom title.
[Obsolete("Use ShowAsync instead. This will be removed in future major version.")]
public IDialogReference Show<T>(string? title) where T : IComponent
Parameters
titlestringThe text at the top of the dialog.
Returns
- IDialogReference
A reference to the dialog.
Type Parameters
T
Show<T>(string?, DialogOptions)
Displays a dialog with a custom title and options.
[Obsolete("Use ShowAsync instead. This will be removed in future major version.")]
public IDialogReference Show<T>(string? title, DialogOptions options) where T : IComponent
Parameters
titlestringThe text at the top of the dialog.
optionsDialogOptionsThe custom display options for the dialog.
Returns
- IDialogReference
A reference to the dialog.
Type Parameters
T
Show<T>(string?, DialogParameters)
Displays a dialog with custom parameters.
[Obsolete("Use ShowAsync instead. This will be removed in future major version.")]
public IDialogReference Show<T>(string? title, DialogParameters parameters) where T : IComponent
Parameters
titlestringThe text at the top of the dialog.
parametersDialogParametersThe custom parameters to set within the dialog.
Returns
- IDialogReference
A reference to the dialog.
Type Parameters
T
Show<T>(string?, DialogParameters, DialogOptions?)
Displays a dialog with custom options and parameters.
[Obsolete("Use ShowAsync instead. This will be removed in future major version.")]
public IDialogReference Show<T>(string? title, DialogParameters parameters, DialogOptions? options) where T : IComponent
Parameters
titlestringThe text at the top of the dialog.
parametersDialogParametersThe custom parameters to set within the dialog.
optionsDialogOptionsThe custom display options for the dialog.
Returns
- IDialogReference
A reference to the dialog.
Type Parameters
T
Events
DialogInstanceAddedAsync
Occurs when a new dialog instance is created.
public event Func<IDialogReference, Task>? DialogInstanceAddedAsync
Event Type
OnDialogCloseRequested
Occurs when a request is made to close a dialog.
public event Action<IDialogReference, DialogResult?>? OnDialogCloseRequested