Share via


UI Automation Support for the 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 the Text control type, 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 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:

  • ListItem
  • TreeItem
  • DataItem

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 always have zero children in the content view.

Required UI Automation 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 UI Automation Properties for Clients.

UI Automation Property Value Notes
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 Text This value is the same for all UI frameworks.
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 is always the text that it displays.

Required UI Automation 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/Pattern Property Support/Value 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 UI Automation 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 None
UIA_BoundingRectanglePropertyId property-changed event. None
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_Text_TextChangedEventId If the control supports the Text control pattern, it must support this event.