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

Hierarchy in ApplicationTheme

1 Answer 73 Views
Themes and Visual Style Builder
This is a migrated thread and some comments may be shown as answers.
Maarten
Top achievements
Rank 1
Maarten asked on 18 Sep 2008, 02:02 PM
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.

Examples:
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,

Maarten

1 Answer, 1 is accepted

Sort by
0
Mike
Telerik team
answered on 19 Sep 2008, 04:29 PM
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,
Mike
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Themes and Visual Style Builder
Asked by
Maarten
Top achievements
Rank 1
Answers by
Mike
Telerik team
Share this question
or