This is a migrated thread and some comments may be shown as answers.

Telerik WPF Windows 8 Theme modification...

2 Answers 339 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Craig
Top achievements
Rank 1
Craig asked on 04 Jan 2017, 05:02 PM

I am using the Telerik Windows 8 theme in my WPF application.  However, I do not like the way the checkbox checked state is indicated using a colored square rather than an actual check mark as in the Windows 7 theme.  It was very simple to copy the checkbox template and modify it to use the checkbox check mark from the Windows 7 theme checkbox template.  However, I am having trouble finding a way to add this modified template to my Application.Resources in such a way as to apply it to all checkboxes in my application.  For some reason, the template in the Telerik Windows 8 theme continues to override my new checkbox style and I am not sure why.

 

I have tried a few different approaches, yet nothing seems to work.  My latest approach is to add the following style to my Application.Resources resource dictionary:

 

<Style BasedOn="{StaticResource {telerik:ThemeResourceKey ThemeType=telerik:Windows8Theme, ElementType=CheckBox}}" TargetType="CheckBox" >

    <Setter Property="Template">

    ....

    </Setter>

</Style>

 

I would really appreciate any input.  How can I apply a checkbox template modification to all of the checkboxes in my application??

 

Thanks!

Craig

2 Answers, 1 is accepted

Sort by
0
Lance | Manager Technical Support
Telerik team
answered on 05 Jan 2017, 08:28 PM
Hello Craig,

In order for you to accomplish what you need, you must use the Implicit Styling approach. Please read that article for a full explanation and steps to implement (there are also a few tutorials on how to style controls and custom controls).

To help get you up and running quickly, I've attached a demo to demonstrate Implicit Styling. Even when a Checkbox is within a custom template in a GridView, you'll see the style applied. (see attached screenshot).

Here's the style you see in the screenshot:
<Style BasedOn="{StaticResource CheckBoxStyle}" TargetType="CheckBox">
    <Setter Property="Background" Value="GreenYellow"/>
</Style>


Switching your app to leverage Implicit Styling


Please review the full documentation, but here are the mainsteps to switch to Implicit Styling:

1 - Reference the NoXaml DLLs (in C:\Program Files (x86)\Telerik\UI for WPF R3 2016\Binaries.NoXaml)

2 - Either reference the Theme's DLL (most common approach) or copy the XAML files of the controls into the app. In my demo, I use the Theme's DLL.

3 - Merge the controls' ResourceDictionaries in App.xaml (make sure you merge the ones you need, see here)

<ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/System.Windows.xaml" />
                <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.xaml" />
                <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.Input.xaml" />
                <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.GridView.xaml" />
</ResourceDictionary.MergedDictionaries>

Now, you can override any style or template for the UI for WPF controls.

Please let us know if you have any further trouble.

Regards,
Lance | Tech Support Engineer, Sr.
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Craig
Top achievements
Rank 1
answered on 05 Jan 2017, 09:52 PM

This appears to be exactly what I needed to know, Lance. 

Much appreciated,

Craig

Tags
General Discussions
Asked by
Craig
Top achievements
Rank 1
Answers by
Lance | Manager Technical Support
Telerik team
Craig
Top achievements
Rank 1
Share this question
or