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

programmatically set theme at runtime

7 Answers 1189 Views
Themes and Visual Style Builder
This is a migrated thread and some comments may be shown as answers.
amrutha anil
Top achievements
Rank 1
amrutha anil asked on 12 Aug 2010, 07:51 AM
Hi,
 I would like to set the default themes provided by telerik during the run time. Can I set the themes without dropping the theme controls and generate it during the run time?
Thanks
Jay
Top achievements
Rank 1
Iron
Iron
commented on 15 Feb 2023, 06:32 PM

This doesn't make any sense: new Office2007Black().Deserialize();

Where's the l-value? What is this even doing?

Dess | Tech Support Engineer, Principal
Telerik team
commented on 16 Feb 2023, 05:34 AM

Hi, Jay,

Please refer to the following help article which demonstrates how to set a theme programmatically:

https://docs.telerik.com/devtools/winforms/styling-and-appearance/using-default-themes#setting-a-default-theme-for-a-whole-application-programmatically 

I believe that it would be helpful for you.

7 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 17 Aug 2010, 05:08 PM
Hi amrutha anil,

You can do so, but you will have to make sure that you reference the desired theme DLL in your project. After referencing the required DLLs, you can deserialize the theme you would like to use and apply it to a given control as the code snippet below demonstrates:

new Office2007Black().Deserialize();
this.radPageView1.ThemeName = "Office2007Black";

I hope this helps.

All the best,
Deyan
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
Brennan
Top achievements
Rank 1
answered on 10 Sep 2010, 08:27 PM
What if the theme you want to load at runtime is a theme created in the visual style builder and is an xml file? Is this possible?
0
Nikolay
Telerik team
answered on 17 Sep 2010, 09:14 AM
Hello Brennan,

Yes, this scenario is possible. After you create a theme saving as an xml file, you should use RadThemeManager to load it in your application. Please refer to this article for additional information.

Regards,
Nikolay
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
Brennan
Top achievements
Rank 1
answered on 17 Sep 2010, 03:13 PM
Well I meant without having to drop a radthememanager onto the form and just purely in code; I should have been more specific.  Thanks for the reply.

Cheers,

Brennan
0
Stefan
Telerik team
answered on 23 Sep 2010, 09:06 AM
Hello Brennan,

Thank you for writing.

The easiest way of achieving this scenario will be to save your theme as a package (.tssp file). Saving a theme as package instead of saving it as XML files can be done by clicking File >> Save As >> check the Save As Package checkmark, in Visual Style Builder. Then all you have to do is to load the theme in your project and set it as a theme for the application as shown in the following code snippet:
ThemeResolutionService.LoadPackageFile = @"My path\MyThemeName.tssp";
ThemeResolutionService.ApplicationThemeName = "Office2010";

I hope you find this information helpful. If there is anything else I can assist you with, do not hesitate to contact me.
 
Regards,
Stefan
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
rouf
Top achievements
Rank 1
answered on 15 Jan 2011, 12:22 PM
I change the themes of my application at runtime. But it gives me a flicker (which is 9.5 on richter scale) which is quite visible and hence unacceptable. Here is how i set the theme at runtime

ThemeResolutionService

 

 

.ApplicationThemeName = "ThemeName" 

 


Please help me out.
0
Stefan
Telerik team
answered on 19 Jan 2011, 02:37 PM
Hello rouf,

Thank you for writing.

The described behavior is uncommon when using this functionality. Therefore, I would like to kindly ask you to open a new support ticket where you can attach files and send us a sample project demonstrating this issue. This will allow us to trace and solve any possible issues.

I am looking forward to your support ticket.
 
Regards,
Stefan
the Telerik team
Q3’10 SP1 of RadControls for WinForms is available for download; also available is the Q1'11 Roadmap for Telerik Windows Forms controls.
Tags
Themes and Visual Style Builder
Asked by
amrutha anil
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Brennan
Top achievements
Rank 1
Nikolay
Telerik team
Stefan
Telerik team
rouf
Top achievements
Rank 1
Share this question
or