How do I use a theme on a RadToggleButtonElement in a RadRibbonBar?

6 posts, 0 answers
  1. Emily
    Emily avatar
    9 posts
    Member since:
    Feb 2016

    Posted 01 Mar Link to this post

    I have some RadToggleButtonElements in a RadRibbonBar, and I'm trying to apply a theme to them. I already have a theme manager assigned to the ribbon bar, and it appears to be working correctly for the other control types on the ribbon bar. The RadToggleButton theme is loaded into the theme manager but it isn't being applied to the toggle buttons. I've checked the IsThemeApplied property on the buttons at runtime just to be sure, and it's always false. I found a previous post (http://www.telerik.com/forums/toggle-button-style) about how to add a RadStylesheetRelation to the RadToggleButton theme's xml file, and I tried that, but it's still not working. Is there something else I'm missing?

    Note: This same RadToggleButton theme is used on another form as well, and it's working there, so I don't believe there's anything wrong with the theme itself. The only difference that I can see is that the toggle buttons on the other form are not being used in a ribbon bar.

     

    Thank you!

  2. Hristo Merdjanov
    Admin
    Hristo Merdjanov avatar
    711 posts

    Posted 02 Mar Link to this post

    Hi Emily,

    Thank you for writing.

    In order to theme the RadToggleButtonElements in RadRibbonBar, you would need to work with the ribbon bar theme and modify the ToggleButtonInRibbon node.

    The toggle buttons in the ribbon are visual elements and they have specific settings related to the ribbon which are different compared to the toggle button control. I am sending you attached a screenshot from the VSB tool showing where exactly the toggle button is located in the ribbon bar hierarchy.

    I hope this helps. Should you have further questions please do not hesitate to write back.

    Regards,
    Hristo Merdjanov
    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Emily
    Emily avatar
    9 posts
    Member since:
    Feb 2016

    Posted 02 Mar in reply to Hristo Merdjanov Link to this post

    Hi Hristo,

    Thank you for the response. I guess I didn't include enough details (my mistake!). I'm actually using the toggle buttons in the quick access toolbar, and the setting you pointed to doesn't appear to affect the buttons in that part of the ribbon. Is there another way to do this? Thanks again!

    Emily

  5. Hristo Merdjanov
    Admin
    Hristo Merdjanov avatar
    711 posts

    Posted 02 Mar Link to this post

    Hi Emily,

    Thank you for writing.

    The toggle button elements in the quick access menu have a transparent fill. If it is convenient enough, you can perform this styling in the Visual Studio designer with Element Hierarchy Editor tool. For reference, I am also attaching a screenshot.

    If you prefer to perform this change at run-time you can access the toggle button element directly and change the color of its FillPrimitive:
    this.radToggleButtonElement1.ButtonFillElement.BackColor = Color.Green;

    I hope this helps. Should you have further questions please do not hesitate to write back.

    Regards,
    Hristo Merdjanov
    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
  6. Emily
    Emily avatar
    9 posts
    Member since:
    Feb 2016

    Posted 02 Mar in reply to Hristo Merdjanov Link to this post

    Ok - I'll give that a try. I was hoping that I could use the stylesheet (ie the xml file for the RadToggleButton control) to have it automatically set the appropriate BackColor when the button is checked vs. unchecked, but it sounds like that won't work for toggle buttons in the QuickAccessToolBar. Thanks!
  7. Dess
    Admin
    Dess avatar
    1607 posts

    Posted 03 Mar Link to this post

    Hello Emily,

    Thank you for writing back. 

    By default, RadRibbonBar uses RadButtonElement, not RadToggleButtonElement in its quick access toolbar. In order to customize its color, you can refer to the attached screenshot from Visual Style Builder illustrating what changes are required. I have attached my sample project as well.

    I hope this information helps. If you have any additional questions, please let me know.

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