I have just started playing with Microsoft's 08/2010 WPF Ribbon release. The basics appear pretty straightforward, but how would I create a RibbonToggleButton group that would allow only one button in the group to be selected at one time, similar to the way that radio buttons are supposed to behave? Thanks for your help.
In the first version of the Microsoft WPF Ribbon bar we had to put some code in the code behind to get the desired single select toggle effect.
The (Ribbon)ToggleButton's behavior is not the same as a radio button's group where you can set a group and only one can be checked at a time. You'll need to write up a RibbonToggleButton.Checked
event to handle the desired behavior. There's nothing wrong with this method (considering mvvm) since the code-behind is specifically dealing with UI behavior.
We had done a similar implementation using the first version of the Ribbon release:
- create a RibbonGroup
- add the RibbonToggleButtons to the RibbonGroup
- wire up a Checked event to each button (they all share the same handler)
The checked event will find all the RibbonToggleButton's in the RibbonGroup and uncheck them, and then check the button being checked.
This may be another alternative How to get a group of toggle buttons to act like radio buttons in WPF?