Silverlight Tip of the Day #53 – MessageBox is now Available in Silverlight 2
In Silverlight 2 you can now put up Message Boxes. The call is simple and straight forward and can be made without any input from a user.
This method takes the following three parameters with the last parameters being optional:
- String – The message you want to display
- String – The caption you want to display
- MessageBoxButton – Either MessageBoxButton .OKCancel or MessageBoxButton .OK
It returns a MessageBoxResult which you can use to check which button the user clicked.
Here is an example that displays an initial message, then prompts the user for input on whether to play again:
MessageBox.Show("You won the game!");
MessageBoxResult result = MessageBox.Show("Do you want to play again?", "Restart", MessageBoxButton.OKCancel);
if (result == MessageBoxResult.OK)
{
}
Thank you,
--Mike Snow
Subscribe in a reader