programmatically set theme at runtime

8 posts, 0 answers
  1. amrutha anil
    amrutha anil avatar
    8 posts
    Member since:
    Jan 2010

    Posted 12 Aug 2010 Link to this post

    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
  2. Deyan
    Admin
    Deyan avatar
    2038 posts

    Posted 17 Aug 2010 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Brennan
    Brennan avatar
    39 posts
    Member since:
    Sep 2010

    Posted 10 Sep 2010 Link to this post

    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?
  5. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 17 Sep 2010 Link to this post

    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
  6. Brennan
    Brennan avatar
    39 posts
    Member since:
    Sep 2010

    Posted 17 Sep 2010 Link to this post

    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
  7. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 23 Sep 2010 Link to this post

    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
  8. rouf
    rouf avatar
    4 posts
    Member since:
    Jan 2011

    Posted 15 Jan 2011 Link to this post

    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.
  9. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 19 Jan 2011 Link to this post

    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.
Back to Top
UI for WinForms is Visual Studio 2017 Ready