UI Automation Support for the Button Control Type
This topic provides information about Microsoft UI Automation support for the Button control type.
A button is an object that a user interacts with to perform an action such as the OK and Cancel buttons on a dialog box. The button control is a simple control to expose because it maps to a single command that the user wishes to complete.
The following sections define the required UI Automation tree structure, properties, control patterns, and events for the Button control type. The UI Automation requirements apply to all button controls, whether Microsoft Windows Presentation Foundation (WPF), Microsoft Win32, or Windows Forms.
This topic contains the following sections.
- Required UI Automation Tree Structure
- Required UI Automation Properties
- Required UI Automation Control Patterns
- Required UI Automation Events
- 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 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 |
---|---|
|
|
Required UI Automation Properties
The following table lists the UI Automation properties whose value or definition is especially relevant to the controls that implement the Button control type (such as button controls). For more information about UI Automation properties, see UI Automation Properties for Clients.
UI Automation Property | Value | Notes |
---|---|---|
UIA_AcceleratorKeyPropertyId | See notes. | The Button control typically supports an accelerator key to enable the end user to quickly perform the action represented by the button from the keyboard. |
UIA_AutomationIdPropertyId | See notes. | The value of this property needs to be unique across all controls in an application. |
UIA_BoundingRectanglePropertyId | See notes. | The outermost rectangle that contains the whole control. |
UIA_ClickablePointPropertyId | 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, override and provide a clickable point. |
UIA_ControlTypePropertyId | Button | This value is the same for all UI frameworks. |
UIA_HelpTextPropertyId | See notes. | The help text should indicate what the end result of activating the button will be. This is typically the same type of information presented through a tooltip. |
UIA_IsContentElementPropertyId | TRUE | The button control must always be content. |
UIA_IsControlElementPropertyId | TRUE | The button control must always be a control. |
UIA_IsKeyboardFocusablePropertyId | See notes. | If the control can receive keyboard focus, it must support this property. |
UIA_LabeledByPropertyId | Null | Button controls are self-labeled by their contents. |
UIA_LocalizedControlTypePropertyId | See notes. | Localized string corresponding to the Button control type. The default value is "button" for en-US or English (United States). |
UIA_NamePropertyId | See notes. | The name of the button control is the text used to label it. Whenever an image is used to label a button, alternate text must be supplied for the button's Name property. |
Required UI Automation Control Patterns
The following table lists the UI Automation control patterns required to be supported by all button controls. For more information on control patterns, see UI Automation Control Patterns Overview.
Control Pattern/Pattern Property | Support/Value | Notes |
---|---|---|
IExpandCollapseProvider | See notes. | When a button is hosted as a child of a split button, the child button can support the ExpandCollapse pattern instead of the Invoke or Toggle pattern. The ExpandCollapse pattern can be used for opening or closing a menu or other sub-structure associated with the button element. |
IInvokeProvider | See notes. | The Invoke pattern must be supported when the button performs a command at the request of the user. This command maps to a single operation such as Cut, Copy, Paste, or Delete. |
IToggleProvider | See notes. | The Toggle pattern must be supported if the button can cycle through a series of up to three states. Typically this is seen as an on/off switch for specific features. |
Required UI Automation 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 | None |
UIA_BoundingRectanglePropertyId property-changed event. | None |
UIA_Invoke_InvokedEventId | If the control supports the Invoke control pattern, it must support this 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_NamePropertyId property-changed event. | None |
UIA_StructureChangedEventId | None |
UIA_ToggleToggleStatePropertyId property-changed event. | If the control supports the Toggle control pattern, it must support this event. |