Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

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 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 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 ViewContent View
  • Button
    • Image (0 or more)
    • Text (0 or more)
  • Button

 

Relevant 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 Retrieving Properties from UI Automation Elements.

UI Automation PropertyValueNotes
UIA_AcceleratorKeyPropertyIdSee notes.A 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_AutomationIdPropertyIdSee notes.The value of this property must be unique among all peer elements in the raw view of the UI Automation tree.
UIA_BoundingRectanglePropertyIdSee notes.The outermost rectangle that contains the whole control.
UIA_ClickablePointPropertyIdSee notes.Supported if there is a bounding rectangle. If not every point within the bounding rectangle is clickable, and the element performs specialized hit testing, override and provide a clickable point.
UIA_ControlTypePropertyIdButton
UIA_HelpTextPropertyIdSee 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_IsContentElementPropertyIdTRUEThe button control must always be content.
UIA_IsControlElementPropertyIdTRUEThe button control must always be a control.
UIA_IsKeyboardFocusablePropertyIdSee notes.If the control can receive keyboard focus, it must support this property.
UIA_LabeledByPropertyIdNullButton controls are self-labeled by their contents.
UIA_LocalizedControlTypePropertyIdSee notes.Localized string corresponding to the Button control type. The default value is "button" for en-US or English (United States).
UIA_NamePropertyIdSee 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 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 PropertySupport/ValueNotes
IExpandCollapseProvider See notes.When a button is hosted as a child of a split button, the child button can support the ExpandCollapse control pattern instead of the Invoke or Toggle control pattern. The ExpandCollapse control pattern can be used for opening or closing a menu or other sub-structure associated with the button element.
IInvokeProvider See notes.All buttons should support the Invoke control pattern or the Toggle control pattern but not both. The Invoke control 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.All buttons should support the Invoke control pattern or the Toggle control pattern but not both. The Toggle control 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 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 EventNotes
UIA_AutomationFocusChangedEventId
UIA_BoundingRectanglePropertyId property-changed event.
UIA_Invoke_InvokedEventIdIf 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.
UIA_StructureChangedEventId
UIA_ToggleToggleStatePropertyId property-changed event.If the control supports the Toggle control pattern, it must support this event.

 

Related topics

Conceptual
UI Automation Control Types Overview
UI Automation Overview

 

 

Community Additions

Show:
© 2014 Microsoft