Telerik UI for Windows 8 XAML

In order to globally style the Telerik Controls in your application you can use the predefined Telerik named resources. These resources have to be added with a specific key in a ResourceDictionary that will be used when sytling your application. In the examples below the foreground color of the RadNumericBox will be changed to Green using a SolidColorBrush with TelerikNumericBoxForegroundBrush key.

Important

The specific resource keys defined for each control are listed in the [Control Name] -> Styling -> Telerik Named Brushes sections.

Telerik Named Brushes in Windows 8.1 / Windows Phone 8.1

The new ThemeResource markup extension is used when styling the conrols. The theme could be applied on a per element basis.

  1. Create a ResourceDictionary file in which you define all the resources that you would like to set.

    XAML Copy imageCopy
    <SolidColorBrush x:Key="TelerikNumericBoxForegroundBrush" Color="Green"/>
  2. In the ResourceDictionary in your application resources (App.xaml) you have to define an instance of the UserThemeResources class defined in the Telerik.UI.Xaml.Controls namespace. This class exposes two static properties:

    • DarkResourcesPath (string): Gets or sets the Uri path to the resoure distionary containing theme resource definitions for the Dark theme. If no value is set, the default Dark theme will be used.

    • LightResourcesPath (string): Gets or sets the Uri path to the resoure distionary containing theme resource definitions for the Light theme. If no value is set, the default Light theme will be used.

    XAML Copy imageCopy
    <telerik:UserThemeResources x:Key="MyResources" DarkResourcesPath="ms-appx:///Assets/MyResourcesDark.xaml"/>

    This class will override the default Telerik resources defined for the specific theme.

  3. Now you can change theme of an element:

    XAML Copy imageCopy
    <telerikInput:RadNumericBox x:Name="numericBox"/>
    C# Copy imageCopy
    this.numericBox.RequestedTheme = ElementTheme.Dark;

And this is the result:

Telerik Numeric Box Foreground Brush

See Also