#856 – Placing RadioButtons in a GroupBox
July 4, 2013 1 Comment
When including a group of RadioButton controls in your application, it’s common to put them in a GroupBox. This makes the grouping visible to a customer.
A related group of RadioButtons are normally placed in a panel control, to allow the grouping logic to work correctly. (Only one RadioButton at a time is selected within the group). Because a GroupBox is a ContentControl, rather than a Panel, you’ll want to place a panel within the GroupBox and then place the related RadioButtons within the panel.
<GroupBox Header="Gender"> <StackPanel Margin="10"> <RadioButton Content="Male"/> <RadioButton Content="Female"/> </StackPanel> </GroupBox> <GroupBox Header="Height"> <StackPanel Margin="10"> <RadioButton Content="Tall"/> <RadioButton Content="Short"/> </StackPanel> </GroupBox>
Pingback: Dew Drop – July 5, 2013 (#1,579) | Alvin Ashcraft's Morning Dew