UI Automation Support for the Text Control Type
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.
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 on 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 a:
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
Required UI Automation Properties
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 Property||Value||Notes|
|AutomationIdProperty||See notes.||The value of this property needs to be unique across all controls in an application.|
|BoundingRectangleProperty||See notes.||The outermost rectangle that contains the whole control.|
|ClickablePointProperty||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, then override and provide a clickable point.|
|IsKeyboardFocusableProperty||See notes.||If the control can receive keyboard focus, it must support this property.|
|NameProperty||See notes.||The text bar control's name is always the txt that it displays.|
||Text controls do not have a static text label.|
|ControlTypeProperty||Text||This value is the same for all UI frameworks.|
|LocalizedControlTypeProperty||"text"||Localized string corresponding to the text control type.|
|IsContentElementProperty||Depends||The text control will be content if it contains information not exposed in another control's NameProperty.|
|IsControlElementProperty||True||The text control must always be a control.|
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.
|IValueProvider||Never||Text never supports ValuePattern. If the text is editable, this it is the Edit control type.|
|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).Depends on framework.|
|ITableItemProvider||Depends||If the text element is contained within a Table control, this must be supported.|
|IRangeValueProvider||Depends||If the text element is contained within a table control, this must be supported.|
Required UI Automation Events
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 Event||Support||Notes|
|BoundingRectangleProperty property-changed event.||Required||None|
|IsOffscreenProperty property-changed event.||Required||None|
|IsEnabledProperty property-changed event.||Required||None|
|NameProperty property-changed event.||Required||None|
|ValueProperty property-changed event.||Never||None|