Text Control Type

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

A text control is a basic user interface item that represents a piece of text on the screen.

The following sections define the required UI Automation tree structure, properties, control patterns, and events for the Text control type. The UI Automation requirements apply to all tree 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 text 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
  • Text
  • Text (if content)

 

A text control can be used alone as a label or as static text on a form. It can also be contained within the structure of one of the following items:

Text controls might not appear in the content view of the UI Automation tree because text is often displayed through the Name property of another control. For example, the text used to label a combo box control is exposed through the control's Name property. Because the combo box control is in the content view of the UI Automation tree, the text control need not be there. Text controls may have children in the content view if there is an embedded object such as a hyperlink.

Relevant Properties

The following table lists the UI Automation properties whose value or definition is especially relevant to the text 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. 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_ControlTypePropertyId Text
UIA_IsContentElementPropertyId Depends The text control is content if it contains information not exposed in another control's Name property.
UIA_IsControlElementPropertyId TRUE The text 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 Text controls do not have a static text label.
UIA_LocalizedControlTypePropertyId See notes. Localized string corresponding to the Text control type. The default value is "text" for en-US or English (United States).
UIA_NamePropertyId See notes. The name of a text control can be the text that it displays. However, if the control also supports the Text pattern, and the text is extensive, don't use the full text content as the Name value. Instead, provide a Name value that is shorter, derived from other properties of your control.

 

Required Control Patterns

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

Control Pattern Support Notes
IGridItemProvider Depends If the text control is contained within a table control, the GridItem control pattern must be supported.
ITableItemProvider Depends If the text control is contained within a table control, the TableItem control pattern must be supported.
ITextProvider Depends Text should support the Text control pattern for better accessibility; however, it is not required. The Text control pattern is useful when the text has rich style and attributes (for example, color, bold, and italics).
IValueProvider Never A text control never supports the Value control pattern. If the text is editable, it is the Edit control type.

 

Required Events

The following table lists the UI Automation events that text 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_NamePropertyId property-changed event.
UIA_StructureChangedEventId
UIA_Text_TextChangedEventId If the control supports the Text control pattern, it must support this event.

 

Conceptual

UI Automation Control Types Overview

UI Automation Overview