RadioButton Control Type

This topic provides information about Microsoft UI Automation support for the RadioButton control type.

A radio button consists of a round button and application-defined text (a label), an icon, or a bitmap that indicates a choice the user can make by selecting the button. An application typically uses radio buttons in a group box to permit the user to choose from a set of related, but mutually exclusive options. For example, the application might present a group of radio buttons from which the user can select a format preference for text selected in the client area. The user could select a left-aligned, right-aligned, or centered format by selecting the corresponding radio button. Typically, the user can select only one option at a time from a set of radio buttons.

Note

Another control generalization for buttons where only one in a group can be selected is the content of a toggle button. Some UI frameworks consider a radio button to be a specialized toggle button.

 

The following sections define the required UI Automation tree structure, properties, control patterns, and events for the RadioButton control type. The UI Automation requirements apply to all button controls where the UI framework/platform integrates UI Automation support for control types and control patterns.

This topic contains the following sections.

Typical Tree Structure

The following table depicts a typical control and content view of the UI Automation tree that pertains to radio button controls and describes what can be contained in each view. For more information about the UI Automation tree, see UI Automation Tree Overview.

Control View Content View
  • RadioButton
  • RadioButton

 

There are no children in the control view or the content view.

Relevant Properties

The following table lists the UI Automation properties whose value or definition is especially relevant to the controls that implement the RadioButton control type (such as button controls). For more information about UI Automation properties, see Retrieving Properties from UI Automation Elements.

UI Automation Property Value Notes
UIA_AutomationIdPropertyId See notes. The value of this property must be unique among all peer elements in the raw view of the UI Automation tree.
UIA_BoundingRectanglePropertyId See notes. The outermost rectangle that contains the whole control.
UIA_ClickablePointPropertyId See notes. The clickable point must be a point that, when clicked, selects the radio button.
UIA_ControlTypePropertyId RadioButton
UIA_IsContentElementPropertyId TRUE The radio button control is always included in the content view of the UI Automation tree.
UIA_IsControlElementPropertyId TRUE The radio button control is always included in the control view of the UI Automation tree.
UIA_IsKeyboardFocusablePropertyId See notes. If the control can receive keyboard focus, it must support this property.
UIA_LabeledByPropertyId NULL Radio button controls are self-labeled by their contents.
UIA_LocalizedControlTypePropertyId See notes. Localized string corresponding to the RadioButton control type. The default value is "radio button" for en-US or English (United States).
UIA_NamePropertyId See notes. The name of the radio button control is the text that is displayed beside the button that maintains the selection state.

 

Required Control Patterns

The following table lists the UI Automation control patterns required to be supported by all radio button controls. For more information on control patterns, see UI Automation Control Patterns Overview.

Control Pattern/Pattern Property Support/Value Notes
ISelectionItemProvider Required All radio button controls must support the SelectionItem control pattern to enable themselves to be selected.
SelectionContainer See notes. The SelectionContainer property must always be completed so that a UI Automation client can determine what other radio buttons within a specific context relate to one another. For the Microsoft Win32 version of the radio button, this property is not supported because it is not possible to obtain this information from that legacy framework.
IToggleProvider Never The radio button cannot cycle through its state once it has been set. The Toggle control pattern must never be supported on a radio button.

 

Required Events

The following table lists the UI Automation events that button controls are required to support. For more information on events, see UI Automation Events Overview.

UI Automation Event Notes
UIA_AutomationFocusChangedEventId
UIA_BoundingRectanglePropertyId property-changed event.
UIA_IsEnabledPropertyId property-changed event. If the control supports the IsEnabled property, it must support this event.
UIA_IsOffscreenPropertyId property-changed event. If the control supports the IsOffscreen property, it must support this event.
UIA_SelectionItem_ElementRemovedFromSelectionEventId If the control supports the SelectionItem control pattern, it must support this event.
UIA_SelectionItem_ElementSelectedEventId If the control supports the SelectionItem control pattern, it must support this event.
UIA_StructureChangedEventId

 

Remarks

A radio button represents a single selectable option among a group of peer radio buttons. Ideally, radio buttons should have a grouping element that clarifies the boundaries of the peer radio buttons. Often, however, the boundary is implied by the UI element structure. For example, a menu might contain a set of consecutive radio buttons instead of menu items, or a set of radio buttons that occur after a group label, but before an actionable element such as button.

Conceptual

UI Automation Control Types Overview

UI Automation Overview