# Getting Started with WPF Window

This tutorial will walk you through the creation of a **RadWindow** and will show you how to:

* [Declare a RadWindow](https://www.telerik.com/products/wpf/documentation/controls/radwindow/getting-started#declare-a-radwindow)

* [Show the RadWindow](https://www.telerik.com/products/wpf/documentation/controls/radwindow/getting-started#show-the-radwindow)

* [Add content to the RadWindow](https://www.telerik.com/products/wpf/documentation/controls/radwindow/getting-started#add-content-to-the-radwindow)

* [Use predefined windows](https://www.telerik.com/products/wpf/documentation/controls/radwindow/getting-started#use-predefined-windows)

* [Using RadWindow with NoXaml assemblies](https://www.telerik.com/products/wpf/documentation/controls/radwindow/getting-started#using-radwindow-with-noxaml-assemblies)

## Adding Telerik Assemblies Using NuGet

To use **RadWindow** when working with NuGet packages, install the `Telerik.Windows.Controls.Navigation.for.Wpf.Xaml` package. The [package name may vary](https://www.telerik.com/products/wpf/documentation/installation/manual-setup-guides/nuget/available-packages) slightly based on the Telerik dlls set - [Xaml or NoXaml](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/xaml-vs-noxaml)

Read more about NuGet installation in the [Installing UI for WPF from NuGet Package](https://www.telerik.com/products/wpf/documentation/installation/manual-setup-guides/nuget/nuget-installation) article.

> tip With the 2025 Q1 release, the Telerik UI for WPF has a new licensing mechanism. You can learn more about it [here](https://www.telerik.com/products/wpf/documentation/installation/licensing/installing-license-key).

## Adding Assembly References Manually

If you are not using NuGet packages, you can add a reference to the following assemblies:

* **Telerik.Licensing.Runtime**
* **Telerik.Windows.Controls**
* **Telerik.Windows.Controls.Navigation**
* **Telerik.Windows.Data**

You can find the required assemblies for each control from the suite in the [Controls Dependencies](https://www.telerik.com/products/wpf/documentation/common-information/installation-installing-dependencies-wpf) help article.

## Declare a RadWindow

You can add **RadWindow** manually in XAML as demonstrated if **Example 1**.

**Example 1: Adding RadWindow in XAML**

```XAML
<telerik:RadWindow Height="300" Width="400"/>
```

Here is an example of declaring a **RadWindow** in code.

**Example 2: Adding RadWindow in code**

```C#
RadWindow radWindow = new RadWindow();
radWindow.Width = 400;
radWindow.Height = 300;
```

```VB.NET
	Dim radWindow As New RadWindow()
	radWindow.Width = 400
	radWindow.Height = 300
```

> It's not a good practice do declare your **RadWindow** as visual element in XAML. The only scenario, when it is meaningful to use the **RadWindow** in XAML, is when it represents the entire user control. To learn more about that read [here](https://www.telerik.com/products/wpf/documentation/controls/radwindow/how-to/use-radwindow-as-user-control).

## Show the RadWindow

To open the **RadWindow** you have to call its **Show()** method.

> tip In order to make the window modal you have to call the **ShowDialog()** method. To learn more about modal windows read [here](https://www.telerik.com/products/wpf/documentation/controls/radwindow/features/modal-windows).

**Example 3: Calling the Show() method**

```C#
radWindow.Show();
```

```VB.NET
	radWindow.Show()
```

![Figure 1: An empty RadWindow](https://www.telerik.com/products/wpf/documentation/assets/7700027d7f15dd97d3f8311aeadf5f13/radwindow_gettingstarted_01.png)

## Add content to the RadWindow

To add content to the **RadWindow** you have to use the **Content** property or the **ContentTemplate** property.

> tip As the **Content** property is of type object you can set it to any control that 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**.

> tip You can skip the in-line setting of the **Content** property and define the content directly under the **RadWindow** tag.

> 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](https://www.telerik.com/products/wpf/documentation/controls/radwindow/how-to/use-radwindow-as-user-control).

**Example 4: Setting the Content property**

```C#
Grid grid = new Grid();
grid.Background = new SolidColorBrush(Color.FromArgb(255, 240, 255, 255));
radWindow.Content = grid;
```

```VB.NET
	Dim grid As New Grid()
	grid.Background = New SolidColorBrush(Color.FromArgb(255, 240, 255, 255))
	radWindow.Content = grid
```

![Figure 2: RadWindow with a Grid set as its Content](https://www.telerik.com/products/wpf/documentation/assets/04f42540d44edc1031d4a330ae7fba3b/radwindow_gettingstarted_02.png)

## Use predefined windows

There is a set of predefined dialog windows that can be directly used. Such windows are the **Confirm**, **Alert** and **Prompt** dialogs. These dialogs can be shown by calling the respective methods of the static **RadWindow** class.

> All of the predefined windows are modal windows.

* **Alert()** - shows an alert dialog. This method has 3 overloads. To learn more read [here](https://www.telerik.com/products/wpf/documentation/controls/radwindow/features/predefined-dialogs).

**Example 5: Using the Alert method**

```C#
RadWindow.Alert("Hello!");
```

```VB.NET
	RadWindow.Alert("Hello!")
```

![Figure 3: Result of Example 5](https://www.telerik.com/products/wpf/documentation/assets/1b8e41bf4e916f3d5b492da9ecd6a78c/radwindow_gettingstarted_03.png)

* **Confirm()** - shows a confirm dialog. This method has 2 overloads. To learn more read [here](https://www.telerik.com/products/wpf/documentation/controls/radwindow/features/predefined-dialogs).

**Example 6: Using the Confirm method**

```C#
RadWindow.Confirm(new DialogParameters()
{
    Content = "Are you sure?"
});
```

```VB.NET
	Dim parameters As New DialogParameters()
	parameters.Content = "Are you sure?"
	RadWindow.Confirm(parameters)
```

![Figure 4: Result of Example 6](https://www.telerik.com/products/wpf/documentation/assets/bd3912310a2545649ee262483186873e/radwindow_gettingstarted_04.png)

* **Prompt()** - shows a prompt dialog. This method has 3 overloads. To learn more read [here](https://www.telerik.com/products/wpf/documentation/controls/radwindow/features/predefined-dialogs).

**Example 7: Using the Prompt method**

```C#
RadWindow.Prompt(new DialogParameters()
{
    Content = "Enter your name:"
});
```

```VB.NET
	Dim parameters As New DialogParameters()
	parameters.Content = "Enter your name:"
	RadWindow.Confirm(parameters)
```

![Figure 5: Result of Example 7](https://www.telerik.com/products/wpf/documentation/assets/ac1c866d69620fcd883a821610a42ebe/radwindow_gettingstarted_05.png)

## Using RadWindow with NoXaml assemblies

If you are using [Implicit Styles](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/styling-apperance-styling-the-controls) to style the control, note that the newly created user control will not receive automatically the RadWindow style. The **BasedOn** property of the custom style need to be set to the default style of RadWindow which is **RadWindowStyle**. You should add the following style after the merged dictionaries to fix this:

**Example 8: Custom Style targeting your RadWindow control**

```XAML
<ResourceDictionary>
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="Themes/System.Windows.xaml" />
        <ResourceDictionary Source="Themes/Telerik.Windows.Controls.xaml" />
        <ResourceDictionary Source="Themes/Telerik.Windows.Controls.Navigation.xaml" />
    </ResourceDictionary.MergedDictionaries>
    <Style TargetType="local:RadWindowControl" BasedOn="{StaticResource RadWindowStyle}" />
</ResourceDictionary>
```

## Telerik UI for WPF Learning Resources

* [Telerik UI for WPF Window Component](https://www.telerik.com/products/wpf/window.aspx)
* [Getting Started with Telerik UI for WPF Components](https://www.telerik.com/products/wpf/documentation/getting-started/first-steps-nuget)
* [Telerik UI for WPF Installation](https://www.telerik.com/products/wpf/documentation/installation/manual-setup-guides/installation-guide)
* [Telerik UI for WPF and WinForms Integration](https://www.telerik.com/products/wpf/documentation/common-information/winforms-integration/overview)
* [Telerik UI for WPF Visual Studio Templates](https://www.telerik.com/products/wpf/documentation/installation/manual-setup-guides/visual-studio-templates)
* [Setting a Theme with Telerik UI for WPF](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/styling-apperance-setting-a-theme-overview)
* [Telerik UI for WPF Virtual Classroom (Training Courses for Registered Users)](https://learn.telerik.com/learn/course/external/view/elearning/16/telerik-ui-for-wpf)
* [Telerik UI for WPF License Agreement](https://www.telerik.com/purchase/license-agreement/wpf-dlw-s)

## See Also

* [Visual Structure](https://www.telerik.com/products/wpf/documentation/controls/radwindow/visual-structure)
* [Predefined Dialogs](https://www.telerik.com/products/wpf/documentation/controls/radwindow/features/predefined-dialogs)
* [RadWindowManager](https://www.telerik.com/products/wpf/documentation/controls/radwindow/features/radiwindowmanager)
* [Events](https://www.telerik.com/products/wpf/documentation/controls/radwindow/events-overview)
