Telerik UI for Windows Phone by Progress

Getting Started

The API for RadMessageBox is very simple and consists of a static Show() method with a few overloads.

Using RadMessageBox is really straightforward. For the simplest dialog, showing RadMessageBox looks like this:

CopyC#
RadMessageBox.Show("Title");

The Show() method overloads  have more arguments but for the simplest case, only one is necessary. In this overload, the necessary argument is the message box title.  All other arguments have intuitive default values which make RadMessageBox look like a part of the Windows Phone OS.

Below are all of the Show() overloads with detailed explanations for each argument along with code examples.

CopyC#
public static void Show(object title,
MessageBoxButtons buttons = MessageBoxButtons.OK,
object message = null,
object checkBoxContent = null,
bool isCheckBoxChecked = false,
bool vibrate = false,
HorizontalAlignment horizontalAlignment = HorizontalAlignment.Stretch,
VerticalAlignment verticalAlignment = VerticalAlignment.Top,
Action<MessageBoxClosedEventArgs> closedHandler = null)

The first argument, title, is of type object because it is set internally as the content of a content control. It is a required argument as there is no default value for it. The message of the message box and the content of the check box are also of type object for the same reason.

The second argument is an enumeration with pre-defined button configurations. It can have the following values: OK, OKCancel, Yes and YesNo.

The fifth argument is a Boolean value that determines the initial checked state of the check box.

The sixth argument is also a Boolean value that determines if the device will vibrate when the message box is shown.

The next two arguments specify the horizontal and vertical alignment of the message box on the device screen.

The last argument is an optional callback that will be called when the message box is closed. It provides information for which button was clicked, whether the check box was

Checked, the index of the clicked button in its parent panel and the overall message box result.

CopyC#
public static void Show(
IEnumerable<object> buttonsContent,
object title,
object message = null,
object checkBoxContent = null,
bool isCheckBoxChecked = false,
bool vibrate = false,
HorizontalAlignment horizontalAlignment = HorizontalAlignment.Stretch,
VerticalAlignment verticalAlignment = VerticalAlignment.Top,
Action<MessageBoxClosedEventArgs> closedHandler = null)

This overload differs from the previous one only in the order of the arguments and the first argument.

It is of type IEnumerable<object>. This enumerable contains the content of the buttons that

will be displayed. This enumerable can contain any number of objects of any type which

will be mapped to the buttons in the message box.

CopyC#
public static void Show(
DataTemplate buttonsTemplate,
object title,
IEnumerable<object> buttonsContent,
object message = null,
object checkBoxContent = null,
bool isCheckBoxChecked = false,
bool vibrate = false,
HorizontalAlignment horizontalAlignment = HorizontalAlignment.Stretch,
VerticalAlignment verticalAlignment = VerticalAlignment.Top,
Action<MessageBoxClosedEventArgs> closedHandler = null)

This overload differs from the others in that the first argument is of type DataTemplate. This DataTemplate object can be used to specify an arbitrary layout and adorners for the buttons in the message box.

CopyC#
public static void Show(
ControlTemplate template,
object title,
IEnumerable<object> buttonsContent,
object message = null,
object checkBoxContent = null,
bool isCheckBoxChecked = false,
bool vibrate = false,
HorizontalAlignment horizontalAlignment = HorizontalAlignment.Stretch,
VerticalAlignment verticalAlignment = VerticalAlignment.Top,
Action<MessageBoxClosedEventArgs> closedHandler = null)

The last overload provides the most flexibility and is therefore most time consuming to use. Its first argument is a ControlTemplate. This means that users will have to define a completely new ControlTemplate for the RadMessageBoxControl type in order to use it.