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

How do I set up multiple themes for a control?

4 Answers 119 Views
Themes and Visual Style Builder
This is a migrated thread and some comments may be shown as answers.
Pawz
Top achievements
Rank 1
Pawz asked on 04 Apr 2008, 03:17 AM
I've got a theme that sets my label controls to the font & size etc that I want standardized across the application, but I've got a couple issues that are annoying:

1. Font settings on my designer are being overwritten - my theme size is 8p, I want my header label to be 12p... but it reverts back to 8p when the app loads!

2. Labels that end up on different background colors all revert to the color of the theme!

Now when I'm in VSB there's interesting looking things like control class, but I don't know how to use them or what they're for - I don't mind specifying a certain 'class' to be used for the different areas in the app, but I do need to figure out how it works.

Any help would be appreciated!

4 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 04 Apr 2008, 09:26 AM
Hi Pawz,

Thank you for writing.

This behavior comes from the Theming model. To avoid this issue, you should set RadLabel properties (etc. Font, BackColor) from the smart tag element (see the attached screenshot). I have attached a sample project with different font sizes.

About the Class property - via diffrent class name allow to specify diffrent seting via Theme for the same elements.
For example: add Button into RadTitleBar and add Button with a diffrent class name into the RadTitleBar menu, that will allow you to specify a different setting via the Theme for both buttons.

If you would like to know more about themes please watch following videos:

Video 1 and Video 2

If you have additional questions, do not hesitate to contact me.

All the best,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Pawz
Top achievements
Rank 1
answered on 06 Apr 2008, 11:47 PM
Ah I see how it works then - it doesn't take the actual control values into account, just the radelement values. Fair enough.

I'm still wondering about classes system though - in your example project, would you be able to set the 2 different size labels as 2 different classes? If so, how is that done and how do I create different classes with the VSB? Style classes make me think of CSS, which makes me think I should be able to control the look & feel of my controls specifically by setting their class property.

(Oh! Noticed a little spelling mistake in the VSB - the Style drop down has a description with "Gets or sets the setylesheet associated with the elements")
0
Pawz
Top achievements
Rank 1
answered on 07 Apr 2008, 12:12 AM
Just to make things really clear on what I want:

I need to know if I can have 2 labels on the form, and, similar to HTML & CSS, specify one label to be a 'Header' class, which makes it look like a standard header for my application (Large font, different color, etc), and the other label to "ControlDescription" class.

I want to be able to do this consistently across my application without forcing the developers to manually modify the settings of each control.

So the example above works great, but I'm looking for a way of making sure all my controls across my entire application look consistent. I've got a custom theme going which works well, but now I need to differentiate my labels based on where they are / what they are doing.
0
Nikolay
Telerik team
answered on 09 Apr 2008, 04:37 PM
Hi Pawz,

Thank you for getting back to me.

The Class property is set on the element level and not on a Control level. This means that when creating the theme, the Class property of the element is used to find the element among the other elements.

For example, in RadTabStrip when you set the BackColor of the RadRepeatScrollButtonElement's FillPrimitive the theme file is storing its Class name. Later, when the control has the theme applied to it, this BackColor property will be set for the FillPrimitive with the corresponding Class name.

Since RadLabel is a control, and not an element, you should use different themes for the different labels. You do not need to manually modify the settings for each control if you set them in the theme.

If you have additional questions, do not hesitate to contact me.

Sincerely yours,
Nikolay
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Themes and Visual Style Builder
Asked by
Pawz
Top achievements
Rank 1
Answers by
Peter
Telerik team
Pawz
Top achievements
Rank 1
Nikolay
Telerik team
Share this question
or