RadioButton
Mutually exclusive option with (*) / ( ) indicator and GroupName.
Overview
RadioButton extends ButtonBase and provides a mutually exclusive
selection option. It renders as (*) Content when checked or ( ) Content
when unchecked. RadioButtons sharing the same GroupName under the same parent are
mutually exclusive — checking one automatically unchecks the others in the group.
Unlike CheckBox, a RadioButton cannot be toggled off by clicking it again.
Basic Example
<StackPanel Orientation="Vertical">
<RadioButton Content="Small" GroupName="Size" IsChecked="True" />
<RadioButton Content="Medium" GroupName="Size" />
<RadioButton Content="Large" GroupName="Size" />
</StackPanel>
Properties
| Property | Type | Default | Description |
|---|---|---|---|
| IsChecked | bool | false | Whether this radio button is currently selected. |
| GroupName | string | "" | Name of the mutual exclusion group. All RadioButtons with the same GroupName under the same parent are exclusive. |
| FocusColor | Color | Cyan | Indicator color when the control has focus. |
| HoverColor | Color | Yellow | Indicator color when the mouse hovers over the control. |
| Content | object | null | The label displayed next to the radio indicator. Inherited from ContentControl. |
| Command | ICommand | null | Command executed when the radio button is checked. Inherited from ButtonBase. |
| CommandParameter | object | null | Parameter passed to the Command. Inherited from ButtonBase. |
Examples
Basic Group
<StackPanel Orientation="Vertical">
<TextBlock Text="Select a color:" />
<RadioButton Content="Red" GroupName="Color" />
<RadioButton Content="Green" GroupName="Color" IsChecked="True" />
<RadioButton Content="Blue" GroupName="Color" />
</StackPanel>
Multiple GroupNames
<StackPanel Orientation="Vertical">
<TextBlock Text="Theme:" />
<RadioButton Content="Dark" GroupName="Theme" IsChecked="True" />
<RadioButton Content="Light" GroupName="Theme" />
<TextBlock Text="Font:" />
<RadioButton Content="Monospace" GroupName="Font" IsChecked="True" />
<RadioButton Content="Sans-serif" GroupName="Font" />
<RadioButton Content="Serif" GroupName="Font" />
</StackPanel>
Data-Bound RadioButton
<StackPanel Orientation="Vertical">
<RadioButton Content="Option A"
GroupName="Options"
IsChecked="{Binding IsOptionASelected}" />
<RadioButton Content="Option B"
GroupName="Options"
IsChecked="{Binding IsOptionBSelected}" />
</StackPanel>
Keyboard Shortcuts
| Key | Action |
|---|---|
| Enter | Check this radio button (unchecks others in the same group). |
| Space | Check this radio button (unchecks others in the same group). |
| Tab | Move focus to the next focusable control. |
| Shift+Tab | Move focus to the previous focusable control. |
Key Concepts
RadioButtonextendsButtonBase, inheriting Click event and Command support.- The visual indicator renders as
(*)when checked and( )when unchecked. - RadioButtons with the same
GroupNameunder the same parent container are mutually exclusive — only one can be checked at a time. - Unlike
CheckBox, clicking a checked RadioButton does not toggle it off. - If no
GroupNameis specified, the default empty string group is used, making all ungrouped RadioButtons under the same parent exclusive. - The
Checkedevent fires when a RadioButton becomes selected; the previously selected button firesUnchecked.