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

How to extend the Telerik theme for a custom control

1 Answer 134 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
Patrick asked on 23 Mar 2012, 06:05 PM
Hello,
I have a scenario where I will leave the user change the theme of the application, selecting one of the available Telerik themes.
But I have a custom control that also needs to be themed. I don't want to modify the Telerik defined themes, because it could be complicated when a new version of the RadControls is available.
What would be the best option for this:
  1. Define theme files for the custom control and load them at the same time as the Telerik theme is loaded (how to do this?)
  2. When the custom control is created, detect the current application theme and set the control theme at this time.
Patrick

1 Answer, 1 is accepted

Sort by
0
Pana
Telerik team
answered on 28 Mar 2012, 04:25 PM
Hi,

Create two resource dictionaries that contain implicit styles for your control. When you are applaying a telerik theme, merge one of these two dictioanries to your application resource. For example you could call:

Application.Current.Resources.MergedDictionaries.Clear();
Applicatin.Current.Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = ......

This would apply different implcit styles on your control at runtime.

Implicit styles now work for telerik controls too. You could check how you could apply implicit styles to Telerik controls here
.

Regards,
Pana
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
General Discussions
Asked by
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Pana
Telerik team
Share this question
or