Hierarchy in ApplicationTheme

2 posts, 0 answers
  1. Maarten
    Maarten avatar
    2 posts
    Member since:
    Sep 2008

    Posted 18 Sep 2008 Link to this post

    Hi there,

    i'm new with theming and just created a new application wide theme. I inserted the following code in the MainForm_Load:

    ThemeResolutionService.RegisterThemeFromStorage(ThemeStorageType.Resource, "Program.Resources.ApplicationTheme.xml");  
    ThemeResolutionService.ApplicationThemeName = "ApplicationTheme"

    This works great, also for different UserControls and Forms. But now I want to create some hierarchy within the theme.

    The RadLabel. For most of the time I can use the defined style in the ApplicationTheme. But I also need for a specific number of  labels some header styles (like a <H1> or <H2>, somewhat bigger and Bold).
    The RadButton. Most of the time the buttons are blue, but some buttons must be red.

    How can I achieve this? I can't really find an option in the VisualStyleBuilder. And I played with the <RadStylesheetRelation> section in the XML file combined with the ThemeName and ThemeClassName in the VS designer, but no results so far. Can I implement Theming on a CSS way? Is there any HowTo or Tutorial available?

    Thank you,

  2. Mike
    Mike avatar
    640 posts

    Posted 19 Sep 2008 Link to this post

    Hi Maarten,

    You have several options to achieve your goal:
    1. Customize the specific RadControls instances' visual properties in the designer, using the UI Element editor option, or set the visual property values programmatically in the code of your app. This would be appropriate for scenarios when there are very few instances - buttons for example - to be customized.
    2. Use ThemeClassName to change the default theming for a specific control. You have to assign the same ThemeClassName string value to both <RadStylesheetRelation> object and corresponding RadControl. The problem here is that currently radcontrols will not refresh the theme is ThemeClassName changes. Therefore the best approach would be to set these properties in the code behind in the correct order - first ThemeClassName then ThemeName.
    3. Apply a StyleSheet to a RadControl programmatically.
    I am sorry but no extra documentation is available at the moment for any of the features I'm referencing. That's why I'll try to give you details and prepare a sample describing each approach in the beginning of the next week. Let me know if this will work for you.

    All the best,
    the Telerik team

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