Working with RadWindow
This topic will explain you how to work with the RadWindow in details.
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.
Call the ShowDialog() method of the RadWindow instance to open it as a modal dialog window.
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 RadWindow 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 properties:
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.
CornerRadius: Gets or sets a value that represents the degree to which the corners of the window are rounded.
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.