Telerik Reporting R1 2017

Setting a Theme (Using Implicit Styles)

With the official Q1 2014 release of Telerik Reporting you will have to disable the Telerik StyleManager and to style the controls using implicit styles (e.g. Style without x:Key attribute). There are a number of benefits of using implicit styles over the Telerik StyleManager. Some are listed below:

  • Custom themes are now much easier - created only via merged dictionaries

  • Basing styles on a theme is made simple

  • Improved Blend support

You will find the XAML files with the implicit styles in {Telerik Reporting installation path}/Silverlight.

  • Themes – implicit styles friendly XAML.

This article explains details on using implicit styles with the Silverlight Report Viewer and covers the following topics:

Applying Report Viewer theme globally in your application

The newly included Themes folder lists resource dictionaries by theme name. These resource dictionaries contain implicit styles and relevant needed resources. They can be merged in the resources of your application (in App.xaml) and as a result will be applied implicitly on any Report Viewer that does not have a local Style set.

For the Silverlight Report Viewer you need to add these xaml files for the selected theme:

  • System.Windows.xaml
  • Telerik.Windows.Controls.xaml
  • Telerik.Windows.Controls.Input.xaml
  • Telerik.Windows.Controls.Navigation.xaml

Additionally the xaml file with the corresponding Report Viewer theme has to be added too:

  • Telerik.ReportViewer.Silverlight.xaml
Note Note

You should not set Application Theme using the StyleManager when using implicit styles.

Basing styles on an existing Report Viewer theme

Currently to change an existing Report Viewer theme you can simply copy the original theme and edit the copy. All the styles that are part of the Report Viewer can be found in the respective xaml file. If you need to edit existing Silverlight UI Controls please check the respective article for more information: Telerik UI for Silverlight - Setting a Theme (Using Implicit Styles)

Setting Implicit Style for the Silverlight Report Viewer Example

We will apply implicit styles for the Vista theme in our example project.

  • First add references to the required assemblies (Telerik UI for Silverlight) from Binaries.NoXaml folder.
  • Then add references to the required assemblies for Telerik Reporting - Telerik.Reporting and Telerik.ReportViewer.Silverlight.
  • Create a Themes folder in your project and copy the corresponding XAML files (Telerik UI for Silverlight) from Themes.Implicit/../Vista/../Themes/ folder.
  • In the Themes folder of the project add the respective Report Viewer theme (in our case Vista) from Silverlight/Themes folder.
  • The next step is to merge these ResourceDictionaries in the App.xaml file:
    XAML
     <Application x:Class="SilverlightApplication1.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             >
      <Application.Resources>
        <ResourceDictionary>
          <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="/SilverlightApplication1;component/Themes/System.Windows.xaml"/>
            <ResourceDictionary Source="/SilverlightApplication1;component/Themes/Telerik.Windows.Controls.xaml"/>
            <ResourceDictionary Source="/SilverlightApplication1;component/Themes/Telerik.Windows.Controls.Input.xaml"/>
            <ResourceDictionary Source="/SilverlightApplication1;component/Themes/Telerik.Windows.Controls.Navigation.xaml"/>
            <ResourceDictionary Source="/SilverlightApplication1;component/Themes/Telerik.ReportViewer.Silverlight.xaml"/>
          </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
      </Application.Resources>
    </Application>