WPF Standard Control Demo App › RadioButton
RadioButton Inputs
RadioButton lets the user pick one option out of a group. Checking one button unchecks the others in its group. Which buttons form a group depends on GroupName.
Which buttons form a group without GroupName
RadioButton derives from ToggleButton. Unlike a ToggleButton, clicking a checked RadioButton does not uncheck it: IsChecked stayed True. Only checking another button in the group clears it. A group starts with nothing selected unless one button is set to IsChecked="True", so check one at the start.
Without GroupName, a group is the buttons with the same parent element. Three buttons in one StackPanel formed a group, and buttons in another StackPanel formed a separate one. This breaks when each button has its own parent. Buttons wrapped in a Border each could all be checked at once. So could buttons created by an ItemsControl’s ItemTemplate, whose Parent was null. Give such buttons a GroupName.
How far a GroupName reaches
Buttons with the same GroupName form one group even under different parents: two buttons in two different GroupBoxes unchecked each other. So use a name that is unique in the window; the same name in two sections of one window makes them one group.
The group does not reach beyond the window. The same name in another window and in a Popup formed separate groups, and all three buttons stayed checked, so do not rely on a name to link windows or popups. Named and unnamed buttons do not affect each other either: under the same parent, checking the unnamed ones did not uncheck the one with GroupName="1".
| case | measured |
|---|---|
| base class / default IsChecked | ToggleButton / False |
| checked RadioButton clicked again: IsChecked | True |
| no GroupName, A-C in one StackPanel: all clicked in turn -> checked | C |
| D-E in another StackPanel, clicked after A-C -> checked in A-E | E; A-C: C |
| F and G each wrapped in a Border in one StackPanel: both clicked -> checked | F, G |
| no GroupName, RadioButton in an ItemsControl's ItemTemplate: all clicked -> checked (Parent) | H, I, J (null) |
| same parent: A, B without GroupName and X with GroupName="1"; X, A, B clicked -> checked | B, X |
| GroupName="shared" in two different GroupBoxes: both clicked -> checked | L |
| GroupName="shared" in the window, another window and a Popup: all clicked -> checked | M, N, P |
Which buttons uncheck each other. Measured on .NET 10 / Windows 11.
Binding IsChecked to bool properties
IsChecked binds two-way by default. With three buttons bound to three bool properties, clicking the second button set the properties to A=False, B=True, C=False. The first button’s binding was still in place, so there is no need to clear the other properties by hand. Setting C to true in the source checked the third button and set B to false.
Binding the buttons to one enum property through a converter is another way. The article linked below measures what the converter’s ConvertBack should return, and how GroupName affects the initial selection.
The keyboard moves the focus, not the selection
With the first button checked and focused, the Down arrow moved the focus to the second button, but the first stayed checked. Tab also went to the next button of the same group, not to the next group.
| case | measured |
|---|---|
| IsChecked bound to bool A, B, C (Mode not set); B clicked: source / A still bound | A=False, B=True, C=False / True |
| then C set to true in the source: source / checked | A=False, B=False, C=True / C |
| A checked and focused, Down arrow: focus / checked | B / A |
| focus on A, Tab: focus | B |
| VerticalContentAlignment (value source) | Top (Default) |
| 3-line label, VerticalContentAlignment=Top, RadioButton 200 high: glyph y / label y | 1 (height 12) / -1 (height 47.88) |
| 3-line label, VerticalContentAlignment=Center, RadioButton 200 high: glyph y / label y | 94 (height 12) / 75.56 (height 47.88) |
| 3-line label, VerticalContentAlignment=Center, RadioButton 46.88 high: glyph y / label y | 17.44 (height 12) / -1 (height 47.88) |
Bound IsChecked, the keyboard, and VerticalContentAlignment. Measured on .NET 10 / Windows 11.
Lining the mark up with a label that wraps
VerticalContentAlignment decides where the round mark and the content are placed vertically inside the RadioButton. The default is Top, from the property’s default value; it stayed Top after the default style was applied. With a label that wraps to three lines, Top put the mark at the top of the label. Center centered both in the RadioButton, so the mark lined up with the middle of the label whatever the RadioButton’s height: the centers were both at about 100 in a RadioButton 200 high, and at 23.44 and 22.94 in one 46.88 high, as high as the label.
Trying it in the demo app

The RadioButton page of the demo app has two sections. The GroupName section shows six buttons without a name and six with the names 1 and 2, and the VerticalContentAlignment section chooses the value from a combo box. The “Show Code” link under each section displays its XAML. The following XAML is the named groups in the GroupName section (RadioButtonUsageControl.xaml), with the styles, the surrounding GroupBoxes, and the alignment attributes left out and the namespace declarations added:
<StackPanel xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<RadioButton x:Name="GroupName1ARadioButton" Content="A(Group:1)" GroupName="1" IsChecked="True" />
<RadioButton x:Name="GroupName1BRadioButton" Content="B(Group:1)" GroupName="1" />
<RadioButton x:Name="GroupName1CRadioButton" Content="C(Group:1)" GroupName="1" />
<RadioButton x:Name="GroupName2DRadioButton" Content="D(Group:2)" GroupName="2" IsChecked="True" />
<RadioButton x:Name="GroupName2ERadioButton" Content="E(Group:2)" GroupName="2" />
<RadioButton x:Name="GroupName2FRadioButton" Content="F(Group:2)" GroupName="2" />
</StackPanel>
Related controls and articles
- CheckBox — for options that are on or off independently.
- ToggleButton — the base class, which has no
GroupName. - ComboBox — one choice out of many, in a drop-down list.
- Why a WPF RadioButton Bound to an Enum Shows No Initial Selection — The Role of GroupName — binding a group to one enum property.
Source code and how it was measured
Every behavior on this page was measured by running it on .NET 10 / Windows 11, using RadioButtonDemoScene in this site’s screenshot tool. Clicks were made through the button’s click handling (OnClick). The arrow keys and Tab were sent through WPF’s input manager, the same path as keys typed on a keyboard.