In This Article

MessageBox Class

Displays a message box.

public static class MessageBox
Inheritance:
object object

Methods

RegisterGlobalBuilderConfigureCallback(Action<UserPromptBuilder>?)

Registers a global delegate to be called to configure a new instance of a UserPromptBuilder created specifically for message box prompts.

public static void RegisterGlobalBuilderConfigureCallback(Action<UserPromptBuilder>? callback)
Parameter Type Description
callback Action<UserPromptBuilder>

The callback, which will be invoked immediately after the instance is created and before any instance-specific configuration can be applied.

Show(TopLevel?, string, string?, MessageBoxButtons, MessageBoxImage, MessageBoxResult, Action<UserPromptBuilder>?)

Displays a message box in front of the specified window. The message box displays a message, title bar caption, button, and image; and that accepts a default message box result, a help action, and returns a result.

public static Task<MessageBoxResult> Show(TopLevel? owner, string messageBoxText, string? caption = null, MessageBoxButtons button = MessageBoxButtons.OK, MessageBoxImage image = MessageBoxImage.None, MessageBoxResult defaultResult = MessageBoxResult.None, Action<UserPromptBuilder>? configure = null)
Parameter Type Description
owner TopLevel

A TopLevel (typically a Window) that represents the owner of the message box.

messageBoxText string

A string that specifies the text to display.

caption string

A string that specifies the title bar caption to display.

button MessageBoxButtons

A MessageBoxButtons value that specifies which button or buttons to display.

image MessageBoxImage

A MessageBoxImage value that specifies the image to display.

defaultResult MessageBoxResult

A MessageBoxResult value that specifies the default result of the message box.

configure Action<UserPromptBuilder>

An optional action which will be called to further configure the UserPromptBuilder initialized for the message box, including options to define a Help command.

Returns

Task<MessageBoxResult>:

A MessageBoxResult value that specifies which message box button is clicked by the user.

Show(string, string?, MessageBoxButtons, MessageBoxImage, MessageBoxResult, Action<UserPromptBuilder>?)

Displays a message box that has a message, title bar caption, button, and image; and that accepts a default message box result, a help action, and returns a result.

public static Task<MessageBoxResult> Show(string messageBoxText, string? caption = null, MessageBoxButtons button = MessageBoxButtons.OK, MessageBoxImage image = MessageBoxImage.None, MessageBoxResult defaultResult = MessageBoxResult.None, Action<UserPromptBuilder>? configure = null)
Parameter Type Description
messageBoxText string

A string that specifies the text to display.

caption string

A string that specifies the title bar caption to display.

button MessageBoxButtons

A MessageBoxButtons value that specifies which button or buttons to display.

image MessageBoxImage

A MessageBoxImage value that specifies the image to display.

defaultResult MessageBoxResult

A MessageBoxResult value that specifies the default result of the message box.

configure Action<UserPromptBuilder>

An optional action which will be called to further configure the UserPromptBuilder initialized for the message box, including options to define a Help command.

Returns

Task<MessageBoxResult>:

A MessageBoxResult value that specifies which message box button is clicked by the user.

Inherited Members