# Styling the Predefined Dialogs

This article explains how you could customize the look and feel of the predefined dialog windows.

## Modifying the Default Style

To style the predefined dialogs of the **RadWindow** static class, you have to call them via the overload that takes a **DialogParameters** object as an argument. Learn more about the predefined dialogs in the [Predefined Dialogs](https://www.telerik.com/products/wpf/documentation/controls/radwindow/features/predefined-dialogs) article.

In this article's example we will use **RadAlert**, but the approach is the same for **RadConfirm** and **RadPrompt**.

First, obtain the default style that targets **RadAlert**. See how to do this in the [Editing Control Templates](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/styling-apperance-editing-control-templates) topic. The extracted **RadAlertStyle** will be similar to the following:

**Example 1: Default RadAlertStyle**

```XAML
<Style x:Key="RadAlertStyle" TargetType="telerik:RadAlert">
    <Setter Property="IsTabStop" Value="False"/>
    <Setter Property="MinWidth" Value="275"/>
    <Setter Property="MaxWidth" Value="500"/>
    <Setter Property="SnapsToDevicePixels" Value="True"/>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="telerik:RadAlert">
                
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
```

> If you are not using [Implicit Styles](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/styling-apperance-setting-a-theme-overview) to style the controls, you will need to copy all the resources referenced (with the StaticResources keyword) in the **RadAlertStyle** to your project as well (such as AlertIconTemplate).

Now you can make modifications in the template such as removing the OK button, changing the Alert icon, etc.

And finally, pass the customized **RadAlertStyle** to the predefined dialog via the **DialogParameters** object and its **ContentStyle** property.

**Example 2: Applying customized Style to RadAlert**

```C#
DialogParameters parameters = new DialogParameters();
parameters.ContentStyle = this.Resources["RadAlertStyle"] as Style;
parameters.Content = "Hello";
RadWindow.Alert(parameters);
```

```VB.NET
	Dim parameters As New DialogParameters()
	parameters.ContentStyle = TryCast(Me.Resources("RadAlertStyle"), Style)
	parameters.Content = "Hello"
	RadWindow.Alert(parameters)
```

> caption RadAlert with custom style

![WPF RadWindow RadAlert with custom Style](https://www.telerik.com/products/wpf/documentation/assets/3b33557a73cbc4c71d852db9f4ad7666/radwindow_styles_and_templates_styling_the_predefined_windows_01.png)

## Applying IconTemplate

With the Q1 2016 release of UI for WPF the **IconTemplate** property was introduced. By using it you are now able to easily change the icon of the predefined windows.

Basically, a valid DataTemplate needs to be created and that Template should be passed to the predefined windows via the **DialogParameters** and its **IconTemplate** property.

**Example 3: Defining the DataTemplate**

```XAML
<DataTemplate x:Key="IconTemplate">
    <Image Source="telerik.png" Stretch="Fill" Width="22" Height="22"/>
</DataTemplate>
```

**Example 4: Applying the DataTemplate to the IconTemplate property**

```C#
RadWindow.Alert(new DialogParameters()
{
    Content = "Hello",
    IconTemplate = this.Resources["IconTemplate"] as DataTemplate
});
```

```VB.NET
	RadWindow.Alert(New DialogParameters() With
	{
	    .Content = "Hello",
	    .IconTemplate = TryCast(Me.Resources("IconTemplate"), DataTemplate
	)})
```

> caption RadAlert with set IconTemplate

![WPF RadWindow RadAlert with set IconTemplate](https://www.telerik.com/products/wpf/documentation/assets/e951d8c612416b9820e936bf16bedffb/radwindow_styles_and_templates_styling_the_predefined_windows_02.png)

## Modify WindowStyle

You can also modify the appearance of the window which hosts the dialog content. For the purpose, set the **WindowStyle** property of the **DialogParameters** object.

**Example 5: Default RadAlertStyle**

```XAML
<Style x:Key="RadAlertWindowStyle" TargetType="telerik:RadWindow">
    <Setter Property="CornerRadius" Value="10"/>
</Style>
```

**Example 6: Applying the DataTemplate to the IconTemplate property**

```C#
RadWindow.Alert(new DialogParameters()
{
    Content = "Hello",
    WindowStyle = App.Current.Resources["RadAlertWindowStyle"] as Style
});
```

```VB.NET
	RadWindow.Alert(New DialogParameters() With
	{
	    .Content = "Hello",
	    .WindowStyle = TryCast(App.Current.Resources("RadAlertWindowStyle"), Style)
	)})
```

## See Also

* [Styling the RadWindow](https://www.telerik.com/products/wpf/documentation/controls/radwindow/styles-and-templates/styling-the-radwindow)
* [Change the Default Theme](https://www.telerik.com/products/wpf/documentation/controls/radwindow/how-to/change-the-default-theme)
