Several classes on the same theme for the same control type

2 posts, 0 answers
  1. Jorge Delgado-Lopez
    Jorge Delgado-Lopez avatar
    82 posts
    Member since:
    Aug 2007

    Posted 01 Jul 2008 Link to this post

    Hi,

    I need to create several classes for RadLabel on ONE theme. My problem is that I cannot set the size of the Font without setting the Font Family, which means that the Font set by the theme is overwritten. ("Headers" are bigger than "text").

    Is it possible to have different classes on one theme? 

    Thanks,
    - jorge
  2. Mike
    Admin
    Mike avatar
    640 posts

    Posted 04 Jul 2008 Link to this post

    Hello Jorge,

    I hope I got your request correct. It is possible to set different styles for UI elements that have different "class" names - i.e. different Class property values. But the approach requires the usage of some of the more advanced settings of VSB and control designers. That's why I would suggest you an easier way to achieve what you need.

    You can set the new font setting using just a few lines of code, without changing the Font family in the following way:

    TextPrimitive textUI = (TextPrimitive)this.radLabel1.LabelElement.Children[2]; 
    textUI.Font = new Font(textUI.Font.FontFamily, 12f); 

    I assume that your label is called radLabel1 and that the theme applies the font settings directly on the TextPrimitive element of the label.

    I'm sending you a sample application that demonstrates the approach.

    Kind regards,
    Mike
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top