Multiple Styles for a Control

10 posts, 0 answers
  1. Vic
    Vic avatar
    33 posts
    Member since:
    Dec 2006

    Posted 13 Apr 2009 Link to this post

    I am trying to maintain a single Theme file and would like to define multiple styles for a single control, for example a button.  If I want a purple button in one location and a red one in another, I'd like to be able to define this through a theme file rather than editing the individual elements.  i cant seem to figure out a way of accommodating this.
  2. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 16 Apr 2009 Link to this post

    Hi Vic,

    Thank you for the questions.

    Currently the RadControls for Winforms does not support different themes in one xml file. The only way to make different visual settings on two separate controls from the same type is to make two theme files and apply them individually to your controls.

    Do not hesitate to contact me again if you have other questions.

    Best wishes,
    Martin Vasilev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Adam P
    Adam P avatar
    27 posts
    Member since:
    Jan 2014

    Posted 07 Feb 2014 in reply to Martin Vasilev Link to this post

    Hi, is this still true?  I'm having a hard time understanding the purpose of the ThemeClassName property
  5. Dimitar
    Admin
    Dimitar avatar
    1411 posts

    Posted 11 Feb 2014 Link to this post

    Hi Adam,

    Thank you for writing.

    Yes the previously provided answer is still valid. Also the ThemeClassName property is used in order the control to be bound with the proper styles in the theme. This is why we need to override this property when we creating custom controls for example.

    Please let me know if there is something else I can help you with. 

    Regards,
    Dimitar
    Telerik

    Check out the new Telerik Platform - the only modular platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native apps. Register for the free online keynote and webinar to learn more about the Platform on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT).

  6. Ryan
    Ryan avatar
    1 posts
    Member since:
    Oct 2014

    Posted 05 Jan 2015 Link to this post

    Hi team,

    Can we have multiple themes in one file or still need different theme (.xml) files?

    Best Regards,
    Ryan
  7. Dimitar
    Admin
    Dimitar avatar
    1411 posts

    Posted 08 Jan 2015 Link to this post

    Hello Ryan,

    Thank you for writing.

    You cannot have multiple themes in one file. Visual Style Builder allows you to create a different styles for each control and to save the theme with a particular name. Each control in your application that uses this theme will take the predefined styles from it. In addition you can save the theme as a single file or separate xml files. 

    You can have many themes in one application and you can use different theme for each control. Detailed information about the themes is available in the following articles:
    I hope this helps. Should you have any other questions do not hesitate to ask.

    Regards,
    Dimitar
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  8. Emily
    Emily avatar
    9 posts
    Member since:
    Feb 2016

    Posted 04 Mar in reply to Dimitar Link to this post

    I thought I could use this concept to have a different theme for some of the controls on the ribbon bar, but the controls (in particular the RadButtonElement controls) don't appear to have a ThemeName property. Is it possible to use a separate theme for controls on the ribbon, apart from the theme that's assigned to the ribbon bar itself?

    Thank you!

    Emily

  9. Dimitar
    Admin
    Dimitar avatar
    1411 posts

    Posted 07 Mar Link to this post

    Hello Emily,

    Thank you for writing.

    You can set the theme only for controls, not elements. As a workaround, you can use RadHostItem to add controls to the ribbon:
    var button = new RadButton();
    button.Text = "test";
    button.ThemeName = "TelerikMetro";
    var item = new RadHostItem(button);
    item.MinSize = new Size(200, 22);
    this.RadRibbonBarGroup1.Items.Add(item);

    Please let me know if there is something else I can help you with. 
     
    Regards,
    Dimitar
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  10. Emily
    Emily avatar
    9 posts
    Member since:
    Feb 2016

    Posted 08 Mar in reply to Dimitar Link to this post

    This worked. Thank you!
  11. Emily
    Emily avatar
    9 posts
    Member since:
    Feb 2016

    Posted 08 Mar in reply to Dimitar Link to this post

    This worked. Thank you!
Back to Top
UI for WinForms is Visual Studio 2017 Ready