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

Change Theme Dynamically

9 Answers 372 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Rahul Gupta
Top achievements
Rank 1
Rahul Gupta asked on 27 May 2010, 09:06 AM
How can I change theme dynamically using RadControls.
I already visited this link:
http://www.telerik.com/community/forums/silverlight/general-discussions/how-do-i-apply-a-theme.aspx
but not able to get any solution. Selecting Theme from dropdown Combobox I want to change Theme. How can I acheive that. Till now I have not yet got a single Solution for my problem from the Telerik team. Please help me to solve this issue.

9 Answers, 1 is accepted

Sort by
0
Accepted
Yavor Georgiev
Telerik team
answered on 27 May 2010, 03:44 PM
Hello Rahul Gupta,

 Please find attached a solution demonstrating how to change the theme of a telerik control from a ComboBox.

Regards,
Yavor Georgiev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Rahul Gupta
Top achievements
Rank 1
answered on 28 May 2010, 11:27 AM
Thank you Telerik Team for you Support.
0
Travis
Top achievements
Rank 1
answered on 13 Sep 2010, 06:05 PM
This sample is setting the control in xaml.  How do you do it from code behind.  My scenario is that I've created a RadGridView dynamically and want to set the theme from code behind.
0
Travis
Top achievements
Rank 1
answered on 13 Sep 2010, 06:16 PM
Figured it out:

StyleManager.SetTheme(MyRadControl, new Telerik.Windows.Controls.Office_SilverTheme());
 

 

 

 

 

 

 

 

0
Pic Micro
Top achievements
Rank 1
answered on 16 Sep 2010, 06:26 PM
Hello, Is there way to load a theme from an URL. I'm asking that since I have done some things with Flex and that's one of the things I missed from Flex.

Thx
0
George
Telerik team
answered on 22 Sep 2010, 09:17 AM
Hi Pic,

Our themes can be downloaded dynamically if this suits your needs. I am not sure I understand you question. Could you please give us more detailed information? If you tell us what is your scenario it would be very helpful. 

Regards,
George
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
CyclingFoodmanPA
Top achievements
Rank 2
answered on 04 Mar 2011, 09:51 PM
Hello Yavor,

Great example.  I am wondering how to change themes dynamically for an entire application.  This particular example changes the theme for the grid which is great, but how do you change the theme for an application using the RadControls.  There is an example at: http://weblogs.asp.net/lduveau/archive/2010/05/31/dynamically-apply-and-change-theme-with-the-silverlight-toolkit.aspx that allows you to change the theme for the entire application using the SL toolkit.

Could you or someone put up an example on how to do this with the telerik controls.  I think it is similar to the one above, but I am missing something and cannot get it to work.  I know I am close but I know as soon as I see the correct solution I will probably be mad at myself because I am close.

Thanks for developing great controls.

Keith

P.S. I am using the latest Silverlight RadControls (build from Q4 2010).
0
Yavor Georgiev
Telerik team
answered on 06 Mar 2011, 12:24 AM
Hello Keith,

 The theming mechanism for our Silverlight controls suite is a bit different from the one in the Silverlight Toolkit that Microsoft provides.

 In your UserControl, create a dependency property called CurrentTheme, of type Telerik.Windows.Controls.Theme. Give it a default value of, say, a new instance of the Office_BlackTheme class.

 Then, in the XAML of your UserControl, bind the telerik:StyleManager.Theme attached property of every telerik control to the CurrentTheme property of the UserControl. If you change the value of the CurrentTheme property, all the controls that are bound to it should change as well.

 Unfortunately there is no easy or surefire way to achieve this. We are constantly looking forward to improving our theming mechanism, but keeping it backwards-compatible and consistent across our WPF and Silverlight suites is no easy task. Hopefully we will be able to implement on-the-fly changing of the current application theme in our StyleManager very soon.

Greetings,
Yavor Georgiev
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
John
Top achievements
Rank 1
answered on 14 Aug 2012, 08:49 PM
The above code approach works as per this video .. however the control that I am using to change the theme is a RadComboBox on the selection change event. This works except it does not update the RadComboBox so I then added a StyleManager for the RadComboBox itself, and even though it does change the Theme, I also get an null ref exception. It appears that you can't change a theme within a SelectionChanged event handler else you will throw an exception.  As a simple work-around I created a simple Timer that fires 20 milliseconds post the selection change event, and in which where I apply the newly changed Theme. This works but I do not like this approach.  Is there a better control event that I can use to set the Theme of the control that is altering the Theme?
Tags
General Discussions
Asked by
Rahul Gupta
Top achievements
Rank 1
Answers by
Yavor Georgiev
Telerik team
Rahul Gupta
Top achievements
Rank 1
Travis
Top achievements
Rank 1
Pic Micro
Top achievements
Rank 1
George
Telerik team
CyclingFoodmanPA
Top achievements
Rank 2
John
Top achievements
Rank 1
Share this question
or