Edit this page

Predefined Dialogs

The RadWindow provides you with a set of predefined dialog windows that are an easy way to handle a few scenarios:

  • Alert the user with a certain message

  • Prompt the user for a certain information

  • Allow the user to confirm an action

These windows can be shown using the respective methods of the static RadWindow class:

  • Alert() - 3 overloads

  • Prompt() - 3 overloads

  • Confirm() - 2 overloads

All of the predefined windows are modal!

Each of the methods has an overload that takes an object of type DialogParameters as an argument. The DialogParameters class has members similar to the specific ones of the RadWindow. This allows you to configure the predefined dialogs via the argument of the method.

Here is a list of the DialogParameters class members:

  • CancelButtonContent

  • Closed

  • Content

  • ContentStyle

  • DefaultPromptResultValue

  • Header

  • IconContent

  • ModalBackground

  • OkButtonContent

  • Opened

  • Owner

  • Theme

  • WindowStyle

For more info about the class read here.

Alert

The alert dialog window allows you to alert the user with a certain message. It is shown by calling the Alert() method of the static RadWindow class. It can take one of the following argument groups:

  • DialogParameters dialogParameters - an object of type DialogParameters.

C#

RadWindow.Alert(new DialogParameters()
{
    Content = "Hello"
});

VB.NET

Dim parameters As New DialogParameters()
parameters.Content = "Hello"
RadWindow.Alert(parameters)
  • object content - an object that represents the content.

C#

RadWindow.Alert("Hello");

VB.NET

RadWindow.Alert("Hello")
  • object content, EventHandler<WindowsClosedEventArgs> closed - an object, that represents the content and an event handler that should handle the Closed event of the RadWindow.

C#

public void ShowAlert()
{
    RadWindow.Alert("Hello", this.OnClosed);
}
private void OnClosed(object sender, WindowClosedEventArgs e)
{
}

VB.NET

Public Sub ShowAlert()
    RadWindow.Alert("Hello", AddressOf Me.OnClosed)
End Sub
Private Sub OnClosed(sender As Object, e As WindowClosedEventArgs)
End Sub

Prompt

The prompt dialog window allows the user to input information. It is shown by calling the Prompt() method of the static RadWindow class. It can take one of the following argument groups:

  • DialogParameters dialogParameters - an object of type DialogParameters.

C#

DialogParameters parameters = new DialogParameters();
parameters.Content = "Enter your name:";
RadWindow.Prompt(parameters);

VB.NET

Dim parameters As New DialogParameters()
parameters.Content = "Enter your name:"
RadWindow.Prompt(parameters)
  • object content, EventHandler<WindowsClosedEventArgs> closed - an object that represents the content and an event handler that should handle the Closed event of the RadWindow.

C#

public void ShowPrompt()
{
    RadWindow.Prompt("Enter your name:", this.OnClosed);
}
private void OnClosed(object sender, WindowClosedEventArgs e)
{
}

VB.NET

Public Sub ShowPrompt()
    RadWindow.Prompt("Enter your name:", AddressOf Me.OnClosed)
End Sub
Private Sub OnClosed(sender As Object, e As WindowClosedEventArgs)
End Sub
  • object content, EventHandler<WindowsClosedEventArgs> closed, string defaultPropmptResult - an object that represents the content, an event handler that should handle the Closed event of the RadWindow and a default result value.

C#

public void ShowPrompt()
{
    RadWindow.Prompt("Enter your name:", this.OnClosed, "John Doe");
}
private void OnClosed(object sender, WindowClosedEventArgs e)
{
}

VB.NET

Public Sub ShowPrompt()
    RadWindow.Prompt("Enter your name:", AddressOf Me.OnClosed, "John Doe")
End Sub
Private Sub OnClosed(sender As Object, e As WindowClosedEventArgs)
End Sub

Confirm

The confirm dialog window allows the user to confirm an action. It is shown by calling the Confirm() method of the static RadWindow class. It can take one of the following argument groups:

  • DialogParameters dialogParameters - an object of type DialogParameters.

C#

DialogParameters parameters = new DialogParameters();
parameters.Content = "Are you sure?";
RadWindow.Confirm(parameters);

VB.NET

Dim parameters As New DialogParameters()
parameters.Content = "Are you sure?"
RadWindow.Confirm(parameters)
  • object content, EventHandler<WindowsClosedEventArgs> closed - an object that represents the content and an event handler that should handle the Closed event of the RadWindow.

C#

public void ShowConfirm()
{
    RadWindow.Confirm("Are you sure?", this.OnClosed);
}
private void OnClosed(object sender, WindowClosedEventArgs e)
{
}

VB.NET

Public Sub ShowConfirm()
    RadWindow.Confirm("Are you sure?", AddressOf Me.OnClosed)
End Sub
Private Sub OnClosed(sender As Object, e As WindowClosedEventArgs)
End Sub

Styling the predefined windows

If you want to change the appearance of the predefined window, you have to show it by calling the overload that takes a DialogParameters object as an argument. Create an appropriate style and set it to its WindowStyle property. To learn more read here.

See Also