UI Automation Support for the Text Control Type

 
System_CAPS_ICON_note.jpg 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 UI Automation support for the Text 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.

Text controls are the 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 text controls, whether Windows Presentation Foundation (WPF), Win32, or Windows Forms.

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 on the UI Automation tree, see UI Automation Tree Overview.

Control ViewContent View
TextText (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 a:

  • ListItem

  • TreeItem

  • DataItem

Text controls may not be in the Content View of the UI Automation tree because text is often displayed through the NameProperty of another control. For example the text that is used to label a Combo Box control is exposed through the control's NameProperty value. Because the Combo Box control is in the content view of the UI Automation Tree, it is not necessary for the text control to be there. Text controls always have 0 children in the content view

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

UI Automation PropertyValueNotes
AutomationIdPropertySee notes.The value of this property needs to be unique across all controls in an application.
BoundingRectanglePropertySee notes.The outermost rectangle that contains the whole control.
ClickablePointPropertySee 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.
IsKeyboardFocusablePropertySee notes.If the control can receive keyboard focus, it must support this property.
NamePropertySee notes.The text bar control's name is always the txt that it displays.
LabeledByPropertyNullText controls do not have a static text label.
ControlTypePropertyTextThis value is the same for all UI frameworks.
LocalizedControlTypeProperty"text"Localized string corresponding to the text control type.
IsContentElementPropertyDependsThe text control will be content if it contains information not exposed in another control's NameProperty.
IsControlElementPropertyTrueThe text control must always be a control.

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 PatternSupportNotes
IValueProviderNeverText never supports ValuePattern. If the text is editable, this it is the Edit control type.
ITextProviderDependsText 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).Depends on framework.
ITableItemProviderDependsIf the text element is contained within a Table control, this must be supported.
IRangeValueProviderDependsIf the text element is contained within a table control, this must be supported.

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

UI Automation EventSupportNotes
TextSelectionChangedEventRequiredNone
TextChangedEventRequiredNone
BoundingRectangleProperty property-changed event.RequiredNone
IsOffscreenProperty property-changed event.RequiredNone
IsEnabledProperty property-changed event.RequiredNone
NameProperty property-changed event.RequiredNone
ValueProperty property-changed event.NeverNone
AutomationFocusChangedEventRequiredNone
StructureChangedEventRequiredNone

Text
UI Automation Control Types Overview
UI Automation Overview

Show: