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

Custom control template and using various themes

2 Answers 122 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Vahid
Top achievements
Rank 1
Vahid asked on 13 Dec 2011, 08:53 PM
Hi,
I'm trying to customize the combobox template, so it contains two "refresh" and "add new" buttons in it.
It's done by using Blend, and extracting default template, and then editing it.
But the problem is, when you extract the template, it extract the styles off Office_Black theme (which is default), and the theme gets hard-coded in the template, so when the user tries to change the theme of the application at run time (for example changing to Metro), the combo box stay in Office_Black!

how can i customize the control, but still change the theme at run time?

Thanks in advance

2 Answers, 1 is accepted

Sort by
0
Accepted
Dani
Telerik team
answered on 16 Dec 2011, 01:42 PM
Hello Vahid,

Any change or customization to the style or template of RadComboBox will hard-code resources, regardless of whether it is for Office Black or for another theme. This is inevitable.

If you wish to use more than one theme in your application and to keep changing themes at runtime, the approach you should use is not elegant and will produce a large amount of resources. 

First off, you have to apply your customizations to the RadComboBox style for each Telerik theme. Then, you can either: switch resource dictionaries at runtime, depending on the chosen theme, or you can: create a custom theme corresponding to each Telerik theme and apply it to the RadComboBox control depending on the switched application theme.

As explained, this is not recommended, so it is better to  have a custom RadComboBox with a single theme if this fits in your scenario.

In any case, you will need to also recreate the layout in order for your controls to pick up the new theme.

I hope this helps.

Regards,
Dani
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Vahid
Top achievements
Rank 1
answered on 16 Dec 2011, 05:16 PM
Dani, thanks for your reply!
Tags
ComboBox
Asked by
Vahid
Top achievements
Rank 1
Answers by
Dani
Telerik team
Vahid
Top achievements
Rank 1
Share this question
or