New custom theme to make stand alone

4 posts, 0 answers
  1. Erik
    Erik avatar
    80 posts
    Member since:
    Jul 2007

    Posted 01 Aug 2008 Link to this post

    Hi telerik,

    I have several custom theme. How do I make it standalone like standalone telerik theme in current version?

  2. Peter
    Peter avatar
    1148 posts

    Posted 04 Aug 2008 Link to this post

    Hello Erik,

    Thank you for your interest in RadTheming.

    It is very easy for implementation in custom controls.
    1) Create New Project of type Class library.
    2) Add all themes XML files into this project  and choose for each in properties Build Action: Embedded Resource
    3) The main class in the project (usually Class1) must inherit Component or RadThemeComponentBase
    public class Class1 : Component
    4) Add the following line for each theme file into the class Constructor ThemeResolutionService.RegisterThemeFromStorage(ThemeStorageType.Resource,                                                  @"ClassLibrary1.MyButtonTheme.xml");
    Here is a snapshot from our Aqua theme
    namespace Telerik.WinControls.Themes
        [Description("Enables Aqua theme for the controls in your application")]
        public class AquaTheme: RadThemeComponentBase
            public AquaTheme()
    This component will appear in the Visual Studio toolbox and will be available for drag&drop over existing forms.

    Hope this will clear how the themes work as components.

    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Johan
    Johan avatar
    11 posts
    Member since:
    Mar 2008

    Posted 15 Aug 2008 Link to this post

    Hello, I have tried doing this but it doesn't seem to work.

    This is my code:

    namespace Telerik.WinControls.Themes  
        [Description("Enables Aqua theme for the controls in your application")]  
        public class Class1 : RadThemeComponentBase  
            public Class1()  
                ThemeResolutionService.RegisterThemeFromStorage(ThemeStorageType.Resource, @"Telerik.WinControls.Themes.Class1.Office2007Silver.xml");  

    I have compiled the project (that I added as a Class Library) and added the component Class1 to my form, but I am unable to set the theme to Office2007Silver.
  4. Vassil Petev
    Vassil Petev avatar
    1765 posts

    Posted 18 Aug 2008 Link to this post

    Hi Johan,

    The code snippet from Peter's post is just a snapshot of the Aqua theme component. You do not need to use Telerik.WinControls.Themes namespace in your custom theme components.

    Your theme component is not working most probably because you are giving an incorrect path to the xml theme file. Generally, the string for the path is constructed as it follows: ProjectDefaultNamespace.ContainingFolder.ThemeFileName.xml. The ContainingFolder is only needed if the xml files are in folders in the project structure.

    I have attached a sample project which demonstrates how a ThemeClassLibrary is created and used.

    Contact me again, if you have additional questions.

    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top