Class MessageBox
Provides access to the message box user interface.
public static class MessageBox
- Inheritance
-
MessageBox
- Inherited Members
Properties
IsVisible
Determines if a message box user interface screen is active.
public static bool IsVisible { get; }
Property Value
Methods
Cancel(int?)
Hides the message box interface and returns the parameter as the result of Show(string, string, IEnumerable<string>)
public static void Cancel(int? result)
Parameters
result
int?Result to return
Examples
var colorTask = MessageBox.Show("Color", "What's your favorite color?", new[] { "Red", "Green", "Blue" });
MessageBox.Cancel(0);
var color = await colorTask;
Exceptions
- Exception
Thrown when the message box is not visible
Show(string, string, IEnumerable<string>)
Displays the message box interface asynchronously.
public static Task<int?> Show(string title, string description, IEnumerable<string> buttons)
Parameters
title
stringTitle of the message box.
description
stringDescription of the message box.
buttons
IEnumerable<string>Captions of the message box buttons. Up to three supported.
Returns
Examples
var color = await MessageBox.Show("Color", "What's your favorite color?", new[] { "Red", "Green", "Blue" });
Exceptions
- Exception
Thrown when the message box is already visible