Saturday, December 6, 2008

Trips&Ticks: Do you know how you can use GroupName property of RadioButton for ToggleButton in WPF?


We can use GroupName property for mutually exclusive RadioButton but what can we do if we want to use mutually exclusive ToggleButton? ToggleButton doesn't have like ability. Please, do look in RadioButton what can you see? Exactly, RadioButton is inherit from ToggleButton so we can set in Template property ControlTemplate of ToggleButton. So our RadioButtons will be look like ToggleButtons besides will have GroupName property.

3 comments:

Hardy said...

Could you please post some sample code, and one issue I found was that I had some trouble to apply styles to the new ToggleBotton with RadioButton underneath.

RredCat said...

2Hardy
I use this practice in app of this article http://rredcat.blogspot.com/2009/03/ontime-desktop-light-client.html
RadioButtons (in MainWindow.xaml) are received "ToggleButtonStyle" style (it is in Resources/xamlResources.xaml)

RredCat said...

2Hardy
http://snoopmyversion.googlecode.com/files/LiteOT_src.zip - it is direct link to sources.