In This Article

RadioButton

The RadioButton class provides an implementation of radio buttons.

Note

See the Control Basics topic for many implementation details that are common to the built-in controls such as this one.

Variants

This control supports numerous UI styles (called variants) based on its Context and VariantSize property settings.

Context Variant Size Sample UI
MenuItem Large Screenshot
MenuItem Medium, Small Screenshot
(any other) (any) Screenshot

Capabilities

The following table gives an overview of the capabilities of the control.

Item Details
Supports tall size (fills height of Group) No.
Supports normal size Yes.
Supports use in a Menu Yes.
Base class ButtonBase.
Child items None.
Has popup No.
Key tip access Yes. Set via the KeyTipAccessText property.
Is key tip scope No.
Click event trigger When the radio button is clicked.
Supports use outside of Ribbon Yes.
Supports commands Yes.
Supports ICheckableCommandParameter Yes. Controls the checked state of the radio button.
Supports IValueCommandParameter No.
Default CommandParameter CheckableCommandParameter.

Managing the Checked State

This control is designed to use the WPF command model to maintain the checked state of the control. By default, a CheckableCommandParameter is assigned as the CommandParameter of the control.

See the Interaction with Checkable Controls topic for detailed information on using this command parameter to manage the checked state.

In addition you can manage the checked state of this control programmatically by setting the IsChecked property. When no command is set to the control, the control will automatically toggle IsChecked when it is clicked. By default, it will toggle between true and false, but if IsThreeState is true, it will also toggle into an indeterminate state.

Checked State Events

This control exposes three events that can be raised when the IsChecked property changes value. Each event is raised for a certain value of IsChecked:

Adding a Description for Large Menu Items

Any ButtonBase-derived control has a MenuItemDescription property. This property can be set to a string to display an extended description when used in a large menu context, such as in the application menu.

When set, the Label of the control will be displayed in bold above the description. The description will wrap to as many lines as needed to display itself. This feature is best used on button-based controls that appear on a child menu of a root application menu item.

Sample XAML

This code shows how to prototype this control in XAML-only:

<ribbon:RadioButton Label="Toggle Bold" KeyTipAccessText="B" />

This code shows how to prototype this control in XAML but by also using a ribbon command to set up its user interface:

<ribbon:RadioButton Command="EditingCommands.ToggleBold" KeyTipAccessText="B" />