This is a migrated thread and some comments may be shown as answers.

ToggleButton: custom color settings being applied to all toggle states

1 Answer 445 Views
Buttons, RadioButton, CheckBox, etc
This is a migrated thread and some comments may be shown as answers.
Nisi
Top achievements
Rank 1
Nisi asked on 04 Mar 2009, 07:23 PM
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?

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 09 Mar 2009, 04:36 PM
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.
Tags
Buttons, RadioButton, CheckBox, etc
Asked by
Nisi
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or