Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Buttons, RadioButton, CheckBox, etc > ToggleButton: custom color settings being applied to all toggle states

Not answered ToggleButton: custom color settings being applied to all toggle states

Feed from this thread
  • Nisi avatar

    Posted on Mar 4, 2009 (permalink)

    I have two toggle buttons inside a ribbon bar. I have tried to change the orange background the button has when in the 'on' state, but when i do so, it changes it for all states of the button and you can no longer tell which state the button is in.

    What must i do to be able to change the colors of the individual toggle states?

    Reply

  • Nikolay Nikolay admin's avatar

    Posted on Mar 9, 2009 (permalink)

    Hello Mac & Cheese,

    When you change a color of an element at runtime through the API, this overrides the settings set initially by the theme. Therefore, you lose the colors for the different states.

    In order to achieve the desired scenario, you should change the theme of the RadToggleButtonElement.
    There are two approaches to do this:
    • Make a theme for RadRubbonBar and a theme for RadToggleButton. The ThemeName of both themes should be the same. Then, set the theme of RadRibbonBar to this ThemeName. The style of RadToggleButton element will be changed accordingly.
    • Get the style from a theme made for RadToggleButton and set it to RadToggleButtonElement.

    As you can notice, in both cases you should make a theme for RadToggleButton. This is the correct approach if you want to change a visual property for a state.

    I am attaching a sample project to demonstrate the approach. If you have additional questions, feel free to contact me.

    Best wishes,
    Nikolay
    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.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Buttons, RadioButton, CheckBox, etc > ToggleButton: custom color settings being applied to all toggle states
Related resources for "ToggleButton: custom color settings being applied to all toggle states"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]