# Styling the Controls

Customizing the look and feel of the **Telerik** controls, when using the **NoXAML** binary files, is easy and intuitive due to the provided **theming** mechanism. An important step to remember is to always [base your custom styles](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/styling-apperance-styling-the-controls#basing-a-custom-style-on-a-theme-default-style) on the default one for the theme.

> important This article is relevant, if you are using [implicit styling](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/styling-apperance-setting-a-theme-overview#setting-a-theme-using-implicit-styles) with the [NoXaml](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/xaml-vs-noxaml#noxaml-assemblies) binaries. If you are using the [StyleManager](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/styling-apperance-setting-a-theme-overview#setting-a-theme-using-stylemanager) approach with [Xaml](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/xaml-vs-noxaml#xaml-assemblies) dlls, check out the following article: [Setting a Theme with StyleManager for Telerik UI for WPF](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/stylemanager/common-styling-apperance-setting-theme-wpf).

## Basing a Custom Style on a Theme Default Style

When you create a style that targets a specific control, you should base it on the default style that the theme provides. This way you will make sure that all properties, apart from the changed ones, are inherited from the default style.

We have followed a naming convention where the key for every control's default style consists of **the name of the control followed by a "Style" suffix**. This would mean that the default style applied for the **RadGridView** control is with **x:Key="RadGridViewStyle"**, the default one for the **RadComboBox** with **x:Key="RadComboBoxStyle"**, etc. **Example 1** shows how to create custom styles based on the default one for the **RadComboBox** control:

#### **\[XAML] Example 1: Custom styles for RadComboBox**

```XAML
	<Style x:Key="CustomStyle" TargetType="telerik:RadComboBox" BasedOn="{StaticResource RadComboBoxStyle}">
    	<Setter Property="Foreground" Value="Green" />
	</Style>

	<Style TargetType="telerik:RadComboBox" BasedOn="{StaticResource RadComboBoxStyle}">
    	<Setter Property="Foreground" Value="Red" />
	</Style>
```

> The Telerik themes come also with Styles for some of the [MS native controls](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/how-to/styling-apperance-themes-mscontrols#native-controls-supported-by-the-telerik-theming-mechanism) as TextBox, CheckBox, Button etc. If you want to customize the Style of those controls and keep the Telerik theming you can use the same principle as in **Example1**. For example, the x:Key of the TextBox style is **TextBoxStyle**.

## Styling Custom Controls

Note that custom controls will not automatically receive the inherited control's style. You will have to base your custom style on the default style of the control that is inherited.

**Example 2: Adding Style for styling custom control**

```XAML
    <Application.Resources>
      <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
          <ResourceDictionary Source="Themes/System.Windows.xaml" />
          <ResourceDictionary Source="Themes/Telerik.Windows.Controls.xaml" />
          <ResourceDictionary Source="Themes/Telerik.Windows.Controls.GridView.xaml" />
          <ResourceDictionary Source="Themes/Telerik.Windows.Controls.Input.xaml" />
        </ResourceDictionary.MergedDictionaries>
        <Style TargetType="local:MyCustomGrid" BasedOn="{StaticResource RadGridViewStyle}" />
      </ResourceDictionary>
    </Application.Resources>
```

You will then need to set the control's **DefaultStyleKey**.

**Example 3: Setting the DefaultStyleKey for styling custom control**

```C#
    public class MyCustomGrid : RadGridView
    {
        public MyCustomGrid()
        {
            this.DefaultStyleKey = typeof(MyCustomGrid);
        }
    }
```

```VB.NET
    Public Class MyCustomGrid
        Inherits RadGridView
        Public Sub New()
            Me.DefaultStyleKey = GetType(MyCustomGrid)
        End Sub
    End Class
```

## Control Styles Dependencies

**Example 4** lists the XAML files corresponding to the Telerik assemblies and the dependencies between them.

> If you are using **.NET Core**, note that you have to use **Telerik.Windows.Controls.RichTextBox.xaml** instead of **Telerik.Windows.Documents.xaml** and **Telerik.Windows.Controls.RichTextBoxUI.xaml**.

**Example 4: All XAML files corresponding to the Telerik assemblies**

```XAML
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
    
                            
                <ResourceDictionary Source="Themes/Telerik.Windows.Controls.xaml" />
    
                <ResourceDictionary Source="Themes/System.Windows.xaml" />    
                <ResourceDictionary Source="Themes/Telerik.Windows.Controls.Input.xaml" />
    
                
                <ResourceDictionary Source="Themes/Telerik.Windows.Controls.Navigation.xaml" />
    
                 <ResourceDictionary Source="Themes/Telerik.Windows.Controls.Chart.xaml" />
    
                    
                <ResourceDictionary Source="Themes/Telerik.Windows.Controls.Data.xaml" />
    
                <ResourceDictionary Source="Themes/Telerik.Windows.Controls.DataVisualization.xaml" />
    
                
                <ResourceDictionary Source="Themes/Telerik.Windows.Controls.Docking.xaml" />
    
                <ResourceDictionary Source="Themes/Telerik.Windows.Controls.Expressions.xaml" />
    
                <ResourceDictionary Source="Themes/Telerik.Windows.Controls.FixedDocumentViewers.xaml" />
    
                
                <ResourceDictionary Source="Themes/Telerik.Windows.Controls.GridView.xaml" />
    
                <ResourceDictionary Source="Themes/Telerik.Windows.Controls.ImageEditor.xaml" />
    
                
                <ResourceDictionary Source="Themes/Telerik.Windows.Controls.RibbonView.xaml" />
    
                <ResourceDictionary Source="Themes/Telerik.Windows.Controls.RichTextBoxUI.xaml" />
    
                
                <ResourceDictionary Source="Themes/Telerik.Windows.Controls.ScheduleView.xaml" />
    
                
                <ResourceDictionary Source="Themes/Telerik.Windows.Documents.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
```

## See Also

* [Switch Custom Styles with Themes at Runtime](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/how-to/styling-apperance-custom-styles-themes-runtime)

* [Switch Themes at Design-Time](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/how-to/styling-apperance-switching-themes-design-time)

* [Apply Telerik Themes to Native WPF Controls](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/how-to/styling-apperance-themes-mscontrols)
