Class MessageBox
Static convenience helpers that build a small content tree and show it via Dialog<TResult> - a message with a button row (ShowAsync(Canvas, string, DialogButtons)), or a single-line text prompt (ShowInputAsync(Canvas, string, string?)). A separate, non-generic class rather than static members on Dialog<TResult> itself, to avoid declaring statics on a generic type (CA1000) while keeping Dialog<TResult>'s own API fully type-safe.
public static class MessageBox
- Inheritance
-
MessageBox
- Inherited Members
Methods
ShowAsync(Canvas, string, DialogButtons)
Shows a modal message with a row of buttons, and returns the DialogResult of whichever one the user pressed.
public static Task<DialogResult> ShowAsync(Canvas canvas, string message, DialogButtons buttons = DialogButtons.OK)
Parameters
canvasCanvasThe canvas to show the message box on.
messagestringThe message text to display.
buttonsDialogButtonsWhich buttons to show. Defaults to OK.
Returns
- Task<DialogResult>
A task that completes with the pressed button's DialogResult.
ShowInputAsync(Canvas, string, string?)
Shows a modal single-line text prompt with OK/Cancel buttons.
public static Task<string?> ShowInputAsync(Canvas canvas, string prompt, string? defaultValue = null)
Parameters
canvasCanvasThe canvas to show the prompt on.
promptstringThe prompt text to display above the text box.
defaultValuestringThe text box's initial value. Defaults to an empty string.