We have a project that mainly uses Telerik WPF controls. Unfortunately there are some show stopper bugs in some of the controls (mainly the tab control) that means we needed to drop the windows equivalent in instead. Is there anyway to get the windows controls to style like the telerik ones as currently they don't match at all. I have been told you can do this but cannot find anything on-line about it.
Thanks.In.Advance
OK, this question has already been "answered", but I also found it incredibly hard to find any information, so for those who follow:
Setting the theme for the Telerik controls is easy, eg
Telerik.Windows.Controls.StyleManager.ApplicationTheme = new Telerik.Windows.Controls.SummerTheme();
but what you also have to do is create a resources file that sets the theme for all the windows controls, eg
<ResourceDictionary 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"
>
<Style TargetType="TextBox" BasedOn="{StaticResource {telerik:ThemeResourceKey ThemeType=telerik:SummerTheme, ElementType=TextBox}}" />
<Style TargetType="Button" BasedOn="{StaticResource {telerik:ThemeResourceKey ThemeType=telerik:SummerTheme, ElementType=Button}}" />
<Style TargetType="ListBox" BasedOn="{StaticResource {telerik:ThemeResourceKey ThemeType=telerik:SummerTheme, ElementType=ListBox}}" />
<Style TargetType="CheckBox" BasedOn="{StaticResource {telerik:ThemeResourceKey ThemeType=telerik:SummerTheme, ElementType=CheckBox}}" />
<Style TargetType="PasswordBox" BasedOn="{StaticResource {telerik:ThemeResourceKey ThemeType=telerik:SummerTheme, ElementType=PasswordBox}}" />
<Style TargetType="ScrollViewer" BasedOn="{StaticResource {telerik:ThemeResourceKey ThemeType=telerik:SummerTheme, ElementType=ScrollViewer}}" />
Then you either add it to the app's resources by placing a line in your app.xaml:
<ResourceDictionary Source="Resources/Windows_SummerTheme.xaml" />
or by adding it in code:
Application.Current.Resources.MergedDictionaries.Add("./Resources/Windows_SummerTheme.xaml");
Obviously you can then create a file for each theme and use a case statement so the user can skin the app from a menu.
Hope this helps!
Answer
I managed to find this out from the person that originally told me for anyone having the same problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With