Dela via


UI Automation Support for the CheckBox Control Type

Note

This documentation is intended for .NET Framework developers who want to use the managed UI Automation classes defined in the System.Windows.Automation namespace. For the latest information about UI Automation, see Windows Automation API: UI Automation.

This topic provides information about Microsoft UI Automation support for the CheckBox control type. In UI Automation, a control type is a set of conditions that a control must meet in order to use the ControlTypeProperty property. The conditions include specific guidelines for UI Automation tree structure, UI Automation property values and control patterns.

A check box is an object used to indicate a state that users can interact with to cycle through that state. Check boxes either present a binary (Yes/No), (On/Off), or tertiary (On, Off, Indeterminate) option to the user.

The following sections define the required UI Automation tree structure, properties, control patterns, and events for the CheckBox control type. The UI Automation requirements apply to all check box controls, whether Windows Presentation Foundation (WPF), Win32, or Windows Forms.

This topic contains the following sections.

  • Required UI Automation Tree Structure
  • Required UI Automation Control Patterns
  • Required UI Automation Events
  • Default Action
  • Related Topics

Required UI Automation Tree Structure

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

Control View

Content View

CheckBox

CheckBox

Note

Check boxes never have child elements in the control or content view. If the control does need to contain child elements this indicates that another control type should be used.

Required UI Automation Properties

The following table lists the UI Automation properties whose value or definition is especially relevant to check box controls. For more information about UI Automation properties, see UI Automation Properties for Clients.

UI Automation Property

Value

Notes

AutomationIdProperty

See notes.

The value of this property needs to be unique across all controls in an application.

BoundingRectangleProperty

See notes.

The outermost rectangle that contains the whole control.

ClickablePointProperty

See notes.

Supported if there is a bounding rectangle. If not every point within the bounding rectangle is clickable, and you perform specialized hit testing, then override and provide a clickable point.

ControlTypeProperty

CheckBox

This value is the same for all UI frameworks.

IsContentElementProperty

True

The value of this property must always be True. This means that the check box control must always be included in the content view of the UI Automation tree.

IsControlElementProperty

True

The value of this property must always be True. This means that the check box control must always be included in the control view of the UI Automation tree.

IsKeyboardFocusableProperty

See notes.

If the control can receive keyboard focus, it must support this property.

LabeledByProperty

Null

Check boxes are self-labeling controls.

LocalizedControlTypeProperty

"check box"

Localized string corresponding to the CheckBox control type.

NameProperty

See notes.

The value of the check box control's Name property is the text that is displayed beside the box that maintains the toggle state.

Required UI Automation Control Patterns

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

Control Pattern

Support

Notes

IToggleProvider

Required

Allows the check box to be cycled through its internal states programmatically.

Required UI Automation Events

The following table lists the UI Automation events required to be supported by all check box controls. For more information about events, see UI Automation Events Overview.

UI Automation Event

Support

Notes

AutomationFocusChangedEvent

Required

None

BoundingRectangleProperty property-changed event.

Required

None

IsOffscreenProperty property-changed event.

Required

None

IsEnabledProperty property-changed event.

Required

None

StructureChangedEvent

Required

None

ToggleStateProperty property-changed event.

Required

None

Default Action

The default action of the check box is to cause a radio button to become focused and toggle its current state. As mentioned previously, check boxes either present a binary (Yes/No) (On/Off) decision to the user or a tertiary (On, Off, Indeterminate). If the check box is binary the default action causes the "on" state to become "off" or the "off" state to become "on". In a tertiary state check box the default action cycles through the states of the check box in the same order as if the user had sent successive mouse clicks to the control.

See Also

Reference

CheckBox

Concepts

UI Automation Control Types Overview

UI Automation Overview