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.Controls.Button

  • System.Windows.Controls.ScrollViewer

  • System.Windows.Controls.CheckBox

  • System.Windows.Controls.TextBox

  • System.Windows.Controls.RadioButton

  • System.Windows.Controls.ListBox

  • System.Windows.Controls.PasswordBox

  • System.Windows.Controls.Primitives.RepeatButton

  • System.Windows.Controls.Tooltip

  • System.Windows.Documents.Hyperlink

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:

<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> 

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); 
  } 
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

In this article