Edit this page

Working with RadWindow

This topic will explain you how to work with the RadWindow in details. It will make you familiar with the following:

Create a RadWindow

In order to use the RadWindow in your application you have to add a reference to the Telerik.Windows.Controls.Navigation assembly in your project.

After the reference is available, you can declare a RadWindow. Here is an example.

RadWindow radWindow = new RadWindow();
radWindow.Width = 400;
radWindow.Height = 300;
Dim radWindow As New RadWindow()
radWindow.Width = 400
radWindow.Height = 300

Show the RadWindow

When you want to display the RadWindow you have two options - to display it as a window or as a modal dialog window.

To learn more about modal windows read here.

Call the Show() method of the RadWindow instance to open it as a normal window.

radWindow.Show();
radWindow.Show()

Call the ShowDialog() method of the RadWindow instance to open it as a modal dialog window.

radWindow.ShowDialog();
radWindow.ShowDialog()

Learn more about positioning the RadWindow by reading the Positioning topic.

Add content to the RadWindow

To add a content to the RadWindow you can use either the Content or the ContentTemplate properties.

If you have a window-specific content, use the Content property.

As the Content property is of type object you can set it to any control you like. If you want to have a more complex content that consists of more than one control, be sure to wrap them inside a layout control and pass the layout control as content.You can also set the content of the RadWindow to a UserControl.

The only scenario, where you can add content to the RadWindow at design-time, is when the RadWindow represents an entire user control. To learn more about that read here.

Grid grid = new Grid();
grid.Background = new SolidColorBrush(Color.FromArgb(255, 240, 255, 255));
radWindow.Content = grid;
Dim grid As New Grid()
grid.Background = New SolidColorBrush(Color.FromArgb(255, 240, 255, 255))
radWindow.Content = grid

If you want to share a common layout structure for the content of multiple windows, define an appropriate DataTemplate and set it to the ContentTemplate property of the RadWindow.

<UserControl.Resources>
    <DataTemplate x:Key="WindowContentTemplate">
        <Grid Background="Azure" />
    </DataTemplate>
</UserControl.Resources>

radWindow.ContentTemplate = this.Resources["WindowContentTemplate"] as DataTemplate;
radWindow.ContentTemplate = TryCast(Me.Resources("WindowContentTemplate"), DataTemplate)

Program the RadWindow

The RadWindow exposes a few methods, that allow you to programmatically control its behavior. Here is a list of them:

  • BringToFront - attempts to bring the RadWidnow over any other RadWindows except topmost.

  • Close - closes the RadWindow.

Modify the appearance of the RadWindow

To modify the default appearance of the RadWindow you can use the following brushes:

  • BorderBrush - changes the outer border of the RadWindow and the outer border of its content area.

  • Background - changes the background of the content area.

  • CaptionHeight - gets or sets the height of the extent of the top of the window threatened as the caption.

ModalBackground property is not supported in RadWindow for WPF. The property is available for cross platform compatibility with Silverlight where the ModalBackground appears in the browser.

Also you can create a style and apply it to the RadWindow or modify the default template of the RadWindow to change its overall look. To learn more read the Styles and Templates section.

See Also