How do I set up multiple themes for a control?

5 posts, 0 answers
  1. Pawz
    Pawz avatar
    51 posts
    Member since:
    Aug 2007

    Posted 03 Apr 2008 Link to this post

    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!
  2. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 04 Apr 2008 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Pawz
    Pawz avatar
    51 posts
    Member since:
    Aug 2007

    Posted 06 Apr 2008 Link to this post

    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")
  5. Pawz
    Pawz avatar
    51 posts
    Member since:
    Aug 2007

    Posted 06 Apr 2008 Link to this post

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

    Posted 09 Apr 2008 Link to this post

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