Class MBDialog
This is a general purpose Material Theme dialog.
public class MBDialog : ComponentFoundation, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
- Inheritance
-
MBDialog
- Implements
- Inherited Members
Constructors
MBDialog()
public MBDialog()
Properties
Body
Render fragment for the dialog body.
[Parameter]
public RenderFragment Body { get; set; }
Property Value
Buttons
Render fragment for the dialog buttons. Note that the dialog will
return actions to the consumer when the data-mdc-dialog-action
attribute
is set for a button: MBButton does this via its DialogAction
parameter.
[Parameter]
public RenderFragment Buttons { get; set; }
Property Value
CustomHeader
Render fragment for the dialog custom header. This is outside of the Material Theme spec and is a "Plus" feature.
[Parameter]
public RenderFragment CustomHeader { get; set; }
Property Value
EscapeKeyAction
The action returned by the dialog when the escape key is pressed. Defaults to "close". Setting this to "" will disable the escape key action.
[Parameter]
public string EscapeKeyAction { get; set; }
Property Value
OverflowVisible
Dialogs by default apply overflow: hidden;
. This means that selects or datepickers are often
cropped. Set this parameter to true to make the dialog apply overflow: visible;
to rectify this.
Defaults to false.
[Parameter]
public bool OverflowVisible { get; set; }
Property Value
ScrimClickAction
The action returned by the dialog when the scrim is clicked. Defaults to "close". Setting this to "" will disable scrim click action.
[Parameter]
public string ScrimClickAction { get; set; }
Property Value
Title
The dialog title.
[Parameter]
public string Title { get; set; }
Property Value
Methods
BuildRenderTree(RenderTreeBuilder)
Renders the component to the supplied RenderTreeBuilder.
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
__builder
RenderTreeBuilder
Dispose(bool)
protected override void Dispose(bool disposing)
Parameters
disposing
bool
HideAsync()
Hides the dialog first by allowing Material Theme to close it gracefully, then removing the Blazor markup.
public Task HideAsync()
Returns
NotifyClosed(string)
Do not use. This method is used internally for receiving the "dialog closed" event from javascript.
[JSInvokable]
public Task NotifyClosed(string reason)
Parameters
reason
string
Returns
NotifyOpened()
Do not use. This method is used internally for receiving the "dialog opened" event from javascript.
[JSInvokable]
public void NotifyOpened()
OnAfterRenderAsync(bool)
Material.Blazor components generally should not override this because it handles the case where components need
to be adjusted when inside an MBDialog
or MBCard
.
protected override Task OnAfterRenderAsync(bool firstRender)
Parameters
firstRender
bool
Returns
OnInitializedAsync()
Method invoked when the component is ready to start, having received its initial parameters from its parent in the render tree.
Override this method if you will perform an asynchronous operation and want the component to refresh when that operation is completed.
protected override Task OnInitializedAsync()
Returns
ShowAsync()
Shows the dialog. This first renders the Blazor markup and then allows Material Theme to open the dialog, subsequently initiating all embedded Blazor components.
public Task<string> ShowAsync()