Udostępnij za pośrednictwem


MessageBoxButton Enumeration

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Specifies the buttons to include when you display a message box.

Namespace:  System.Windows
Assembly:  System.Windows (in System.Windows.dll)

Syntax

'Declaration
Public Enumeration MessageBoxButton
public enum MessageBoxButton

Members

Member name Description
Supported by Silverlight for Windows Phone OK Displays only the OK button.
Supported by Silverlight for Windows Phone OKCancel Displays both the OK and Cancel buttons.

Remarks

This enumeration is used by the MessageBox.Show(String, String, MessageBoxButton) method overload.

Examples

The following code example demonstrates how to use this enumeration.

Dim result As MessageBoxResult = _
    MessageBox.Show("Would you like to see the simple version?", _
    "MessageBox Example", MessageBoxButton.OKCancel)

If (result = MessageBoxResult.OK) Then
    MessageBox.Show("No caption, one button.")
End If
MessageBoxResult result = 
    MessageBox.Show("Would you like to see the simple version?", 
    "MessageBox Example", MessageBoxButton.OKCancel);

if (result == MessageBoxResult.OK)
{
    MessageBox.Show("No caption, one button.");
}

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.