New to Telerik UI for WPF? Download free 30-day trial

Theme Palettes

Most Telerik themes support palette helper objects that contain the main resources of the theme (colors, font sizes, etc.). This allows easier access and modification of commonly used resources, thus customizing the applied theme.

The examples in this article show the Windows11Palette, but the same approach is applicable for all palettes. See what themes support palettes in the Available Themes article. The name of the palette class is created by combining the theme name + Palette at the end. Examples: MaterialPalette, FluentPalette, Office2019Palette.

Changing Palette Settings in Code

The palette object can be accessed and modified in code-behind by using the corresponding properties of the palette class (ex: Windows11Palette). The settings should happen before the UI is initialized. For example, in the OnStartup override of the App class or just before the InitializeComponent call of the main window.

Setting palette colors in code

public partial class App : Application 
    protected override void OnStartup(StartupEventArgs e) 
        Windows11Palette.Palette.AccentColor = (Color)ColorConverter.ConvertFromString("#27C106"); 
        Windows11Palette.Palette.CornerRadius = new CornerRadius(5); 
        Windows11Palette.Palette.DisabledOpacity = 0.3; 
        Windows11Palette.Palette.FontSize = 24; 
        Windows11Palette.Palette.ValidationColor = Colors.Red; 
        // etc. 

Changing Palette Settings in XAML

The palette resources can be replaced also in XAML. This can be done by re-defining the resource in XAML and using the same x:Key as the original resource used by the palette. This approach is applicable with .NET 4.5 and later.

To define or modify a theme brush or another theme resource in XAML, use the corresponding markup extension class (ex: Windows11ResourceKey).

Replacing a default palette resource in the App.xaml file globally for all Telerik controls that use this resource

    <SolidColorBrush x:Key="{x:Static telerik:Windows11ResourceKey.AccentBrush}" Color="Purple" /> 

Replacing a default palette resource for a single control instance

        <!-- Control-specific modification --> 
        <SolidColorBrush x:Key="{x:Static telerik:Windows11ResourceKey.AccentBrush}" Color="Purple" /> 

Theme Color Variations

Some of the Telerik themes provide predefined sets of colors (color variations). Applying a color variation goes through the palette color settings and apply the predefined values. See what themes support color variations in the Available Themes article.

To apply a color variation, call the LoadPreset method of the corresponding palette clas (ex: Windows11Palette). The variations are acessed through the ColorVariation enum of the palette.

Setting color variation

public partial class App : Application 
    protected override void OnStartup(StartupEventArgs e) 

Using Palette Resources Stand-Alone

The palette resources can be accessed in XAML and used to style any WPF control using the corresponding markup extension class (ex: Windows11Resource).

Using the Windows11Resource markup extension

<TextBlock Text="A text block colored with the Windows11 AccentBrush"  
           Foreground="{telerik:Windows11Resource ResourceKey=AccentBrush}" /> 

Setting a Theme Color Variation in Design Time

You can change the theme's color variation in design-time. Check this article to see more information on this topic.

See Also

In this article