Improving the ToggleButton

Oct 30, 2009 at 12:36 AM

The way the BureauBlue theme (and I assume others) currently works for toggle buttons, you can't see the state of the button when the mouse is over the button. It looks exactly the same whether the button is checked or unchecked. This makes it harder to use the toggle button than it could be.

To correct this, I suggest replacing the HoverOn and HoverOff storyboards with HoverCheckedOn, HoverCheckedOff, HoverUncheckedOn, HoverUncheckedOff storyboards, then using MultiTriggers that test for each combination of IsMouseOver and IsChecked.

Check out the way way toggle buttons work in the Microsoft Office ribbon for an example of how it should be done.

Feb 12, 2010 at 10:31 PM

I'm having REAL issues with this at the moment with a touch screen application and the BureauBlack theme.  Since it's touch screen the mouse is still over the button after you've clicked it.

I'd be happy enough if there was a way for me to disable all hover states, but for all my Googling I can't figure out how.  :(

I guess I may have to build a custom version of the DLL and manually remove all the hover states if I can't figure out a better way.


Feb 13, 2010 at 12:00 PM

Hastarin why not just use the raw xaml file rather then the dll, then you can just comment out the hover effects whether there implemented via triggers or the visualstatemanager. I don't use the BureauBlack theme, but I am also developing for touch screen and have done something similar with some of the other themes in the pack. I'll be back in the office monday if you need more help.

Feb 13, 2010 at 6:44 PM

Ideally I'd hoped to allow the choice between multiple themes and just override things at my application level.  That doesn't appear to be an option.

I've also noticed the themes aren't really consistent enough to do what I wanted (varying readability of colors, fonts, etc) and will all most likely require some level of tweaking.  For now I've just removed the hover states from the XAML for the BureauBlack and corresponding controls I'm using and built things in to my application.


Feb 15, 2010 at 8:55 AM



ResourceDictionary skin = new ResourceDictionary();

//Set new source.
skin.Source = new Uri(filename, UriKind.Absolute);



Where filename is the absolute path to the xaml file. This overrides at application level, and it allows changing skin at runtime.

Feb 15, 2010 at 4:16 PM

Thanks, that's what I meant by "built things in to my application".  :)