Table of Contents

Class MudMessageBox

Namespace
MudBlazor
Assembly
MudBlazor.dll

A pop-up dialog with a simple message and button choices.

public class MudMessageBox : MudComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IMudStateHasChanged
Inheritance
MudMessageBox
Implements
Inherited Members
Extension Methods

Constructors

MudMessageBox()

public MudMessageBox()

Properties

CancelButton

The custom content for the Cancel button.

[Parameter]
[Category("Behavior")]
public RenderFragment? CancelButton { get; set; }

Property Value

RenderFragment

Remarks

Must be a MudButton. When set, CancelText is ignored.

CancelText

The text of the Cancel button.

[Parameter]
[Category("Behavior")]
public string? CancelText { get; set; }

Property Value

string

Remarks

Defaults to null. When null, the Cancel button will be hidden.

Classname

protected string Classname { get; }

Property Value

string

MarkupMessage

The markup content within this message box.

[Parameter]
[Category("Behavior")]
public MarkupString MarkupMessage { get; set; }

Property Value

MarkupString

Remarks

When MessageContent is set, this property is ignored.

Message

The content within this message box.

[Parameter]
[Category("Behavior")]
public string? Message { get; set; }

Property Value

string

Remarks

When MessageContent is set, this property is ignored.

MessageContent

The custom content within this message box.

[Parameter]
[Category("Behavior")]
public RenderFragment? MessageContent { get; set; }

Property Value

RenderFragment

Remarks

When set, Message and MarkupMessage are ignored.

NoButton

The custom content for the No button.

[Parameter]
[Category("Behavior")]
public RenderFragment? NoButton { get; set; }

Property Value

RenderFragment

Remarks

Must be a MudButton. When set, NoText is ignored.

NoText

The text of the No button.

[Parameter]
[Category("Behavior")]
public string? NoText { get; set; }

Property Value

string

Remarks

Defaults to null. When null, the No button will be hidden.

OnCancel

Occurs when the Cancel button is clicked, or this message box is closed via the Close button.

[Parameter]
public EventCallback<bool> OnCancel { get; set; }

Property Value

EventCallback<bool>

OnNo

Occurs when the No button is clicked.

[Parameter]
public EventCallback<bool> OnNo { get; set; }

Property Value

EventCallback<bool>

OnYes

Occurs when the Yes button is clicked.

[Parameter]
public EventCallback<bool> OnYes { get; set; }

Property Value

EventCallback<bool>

Title

The title of this message box.

[Parameter]
[Category("Behavior")]
public string? Title { get; set; }

Property Value

string

Remarks

Defaults to null. When null, the title will be hidden.

TitleContent

The custom content within the title.

[Parameter]
[Category("Behavior")]
public RenderFragment? TitleContent { get; set; }

Property Value

RenderFragment

Remarks

When set, the Title property is ignored.

Visible

Shows this message box.

[Parameter]
[Category("Behavior")]
public bool Visible { get; set; }

Property Value

bool

Remarks

Can be bound via @bind-Visible to show and hide an inlined MessageBox. Has no effect on previously opened message boxes.

VisibleChanged

Occurs when Visible has changed.

[Parameter]
public EventCallback<bool> VisibleChanged { get; set; }

Property Value

EventCallback<bool>

YesButton

The custom content for the Yes button.

[Parameter]
[Category("Behavior")]
public RenderFragment? YesButton { get; set; }

Property Value

RenderFragment

Remarks

Must be a MudButton. When set, YesText is ignored.

YesText

The text of the Yes/OK button.

[Parameter]
[Category("Behavior")]
public string YesText { get; set; }

Property Value

string

Remarks

Defaults to OK. When null, the Yes button will be hidden.

Methods

BuildRenderTree(RenderTreeBuilder)

protected override void BuildRenderTree(RenderTreeBuilder __builder)

Parameters

__builder RenderTreeBuilder

Close()

Hides this message box.

public void Close()

OnInitialized()

protected override void OnInitialized()

ShowAsync(DialogOptions?)

Shows this message box.

public Task<bool?> ShowAsync(DialogOptions? options = null)

Parameters

options DialogOptions

The optional dialog options to use.

Returns

Task<bool?>

When true, the Yes/OK button was clicked. When false, the No button was clicked. When null, the Cancel button was clicked or this message box was closed.

See Also