Edit this page

Use StyleManager to Apply Theme on MS Controls

The Telerik themes are designed to work mainly with our controls and some native Silverlight controls. Our theming mechanism cannot cover the full control list included in Silverlight.

Native controls supported by the Telerik theming mechanism

Below is the full control list of native Silverlight controls supported by the Telerik theming mechanism:

  • System.Windows.Button

  • System.Windows.ScrollViewer

  • System.Windows.CheckBox

  • System.Windows.TextBox

  • System.Windows.RadioButton

  • System.Windows.ListBox

  • System.Windows.PasswordBox

  • System.Windows.RepeatButton

  • System.Windows.Tooltip

For all of those controls you may specify the theme for them as you may for any Telerik control.

When you apply an Application theme at runtime, though, only Telerik controls will be styled - not the native ones supported by our theming mechanism. If you want to style those native controls based on the current application theme, you should manually set the corresponding theme. For example, the code for a Button would be like so:

XAML

<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             x:Class="RadCalcTest.App">
    <Application.Resources>
        <Style TargetType="Button"/>
    </Application.Resources>
</Application>

C#

public App()
  {
      this.Startup += this.Application_Startup;
      this.Exit += this.Application_Exit;
      this.UnhandledException += this.Application_UnhandledException;
      StyleManager.ApplicationTheme = new Windows7Theme();
      InitializeComponent();
     StyleManager.SetBasedOn(((Style)Current.Resources[typeof(Button)]), StyleManager.ApplicationTheme);
  }

VB.NET

Public Sub New()
    Me.Startup += Me.Application_Startup
    Me.[Exit] += Me.Application_Exit
    Me.UnhandledException += Me.Application_UnhandledException
    StyleManager.ApplicationTheme = New Windows7Theme()
    InitializeComponent()
    StyleManager.SetBasedOn(DirectCast(Current.Resources(GetType(Button)), Style), StyleManager.ApplicationTheme)
End Sub

See Also