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:
- Creating custom themes is now much easier via merged dictionaries
- Basing styles on a theme is made simple
- Improved Blend support
The XAML files with the implicit styles can be found in
%programfiles(x86)%\Progress\Telerik Reporting 2024 Q4\Wpf\Themes\{Theme Name}
.
The available themes are listed in the Telerik UI for WPF article Themes Suite.
This article explains details on using implicit styles with the WPF Report Viewer and covers the following topics:
- Applying Report Viewer theme globally in your application
- Basing styles on Report Viewer style
- Setting Implicit Style for the WPF Report Viewer Example
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 WPF 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.Wpf.xaml
Do 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 WPF UI Controls, please check the respective article, for more information: Telerik UI for WPF - Setting a Theme (Using Implicit Styles)
Setting Embedded Implicit Style for the WPF Report Viewer Example
We will apply embedded implicit styles for the Fluent theme in our example project. The embedded implicit styles are upgradable with the Upgrade Wizard.
-
Replace the referenced Telerik UI for WPF assemblies with assemblies from the
Binaries.NoXaml
folder.If the Telerik UI for WPF assemblies are only used for the report viewer, use Telerik UI for WPF assemblies available with the local demos. They are internally unlocked for the WPF Report Viewer but can only be used with the report viewer. The .NET Framework assemblies containing Telerik UI for WPF are located in
%programfiles(x86)%\Progress\Telerik Reporting 2024 Q4\Bin\WpfViewerDependencies\Framework
. Add reference to the Telerik.ReportViewer.Wpf.Themes assembly.
-
The next step is to merge these
ResourceDictionaries
in theApp.xaml
file:<Application x:Class="WpfApplication1.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" StartupUri="MainWindow.xaml"> <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/Telerik.ReportViewer.Wpf.Themes;component/Themes/Fluent/System.Windows.xaml" /> <ResourceDictionary Source="/Telerik.ReportViewer.Wpf.Themes;component/Themes/Fluent/Telerik.Windows.Controls.xaml" /> <ResourceDictionary Source="/Telerik.ReportViewer.Wpf.Themes;component/Themes/Fluent/Telerik.Windows.Controls.Input.xaml" /> <ResourceDictionary Source="/Telerik.ReportViewer.Wpf.Themes;component/Themes/Fluent/Telerik.Windows.Controls.Navigation.xaml" /> <ResourceDictionary Source="/Telerik.ReportViewer.Wpf.Themes;component/Themes/Fluent/Telerik.ReportViewer.Wpf.xaml" /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> </Application>
Setting Customizable Implicit Style for the WPF Report Viewer Example
We will apply implicit styles for the Vista
theme in our example project. Having the XAML style files in your project enables WPF Report Viewer style customizations.
-
Replace the referenced Telerik UI for WPF assemblies with assemblies from the
Binaries.NoXaml
folder.If the Telerik UI for WPF assemblies are only used for the report viewer, use Telerik UI for WPF assemblies available with the local demos. They are internally unlocked for the WPF Report Viewer but can only be used with the report viewer. The Telerik UI for WPF assemblies are located in
%programfiles(x86)%\Progress\Telerik Reporting 2024 Q4\Bin\WpfViewerDependencies\Framework
. Create a Themes folder in your project and copy the corresponding XAML files (Telerik UI for WPF) from
Themes.Implicit/../Vista/../Themes/
folder.- In the Themes folder of the project add the respective Report Viewer theme (in our case Vista) from
WPF/Themes
folder. -
The next step is to merge these
ResourceDictionaries
in theApp.xaml
file:<Application x:Class="WpfApplication1.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" StartupUri="MainWindow.xaml"> <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/Themes/System.Windows.xaml"/> <ResourceDictionary Source="/Themes/Telerik.Windows.Controls.xaml"/> <ResourceDictionary Source="/Themes/Telerik.Windows.Controls.Input.xaml"/> <ResourceDictionary Source="/Themes/Telerik.Windows.Controls.Navigation.xaml"/> <ResourceDictionary Source="/Themes/Telerik.ReportViewer.Wpf.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> </Application>