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.
the Telerik team