TreeItem Control Type
This topic provides information about Microsoft UI Automation support for the TreeItem control type.
The TreeItem control type represents a node within a tree container. Each node might contain other nodes, called child nodes. Parent nodes, or nodes that contain child nodes, can be displayed as expanded or collapsed.
The following sections define the required UI Automation tree structure, properties, control patterns, and events for the TreeItem control type. The UI Automation requirements apply to all tree item 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
- Relevant Properties
- Required Control Patterns
- Required Events
- Related topics
The following table depicts a typical control and content view of the UI Automation tree that pertains to tree item 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|
Tree item controls can have zero or more tree item children in the content view of the UI Automation tree. If the tree item control has functionality beyond what is exposed in the control patterns listed below, the control should be based on the DataItem control type.
Collapsed tree items do not appear in the control view or content view until they become expanded and visible (or can be scrolled into view).
The control view can contain additional details for a control, including an associated image or a button. For example, an item in an outline view might contain an image as well as a button to expand or collapse the outline. These detail objects do not appear in the content view because the information is already represented by the parent tree item.
Tree items that are scrolled off the screen appear in both the control and content views of the UI Automation tree and should have the IUIAutomationElement::CurrentIsOffscreen (or CachedIsOffscreen) property set to TRUE.
The following table lists the UI Automation properties whose value or definition is especially relevant to the TreeItem control type. 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.||This property must return a location that causes the tree item to change selection state or become focused.|
|UIA_ControlTypePropertyId||TreeItem||This value is the same for all UI frameworks.|
|UIA_IsContentElementPropertyId||TRUE||The tree item control is always included in the content view of the UI Automation tree.|
|UIA_IsControlElementPropertyId||TRUE||The tree item control is always included in the control view of the UI Automation tree.|
|UIA_IsKeyboardFocusablePropertyId||See notes.||If the control can receive keyboard focus, it must support this property.|
|UIA_IsOffscreenPropertyId||See notes.||This property indicates whether a tree item control is scrolled off the screen.|
|UIA_ItemStatusPropertyId||See notes.||If the control contains status that is being updated dynamically, this property must be supported so that an assistive technology can receive updates when the status of the element changes.|
|UIA_ItemTypePropertyId||See notes.||If the tree item control uses a visual icon to indicate that is a particular type of item, this property must be supported and must indicate the item type.|
|UIA_LabeledByPropertyId||NULL||Tree item controls are self-labeling.|
|UIA_LocalizedControlTypePropertyId||See notes.||Localized string corresponding to the TreeItem control type. The default value is "tree item" for en-US or English (United States).|
|UIA_NamePropertyId||See notes.||This property exposes the text displayed for each tree item control.|
The following table lists the UI Automation control patterns required to be supported by all tree item controls. For more information on control patterns, see UI Automation Control Patterns Overview.
|Control Pattern/Pattern Property||Support/Value||Notes|
|IExpandCollapseProvider||Required||All tree items must support the ExpandCollapse control pattern because all items can be expanded or collapsed.|
|ExpandCollapseState||Expanded, Collapsed, or Leaf Node||Tree items are leaf nodes when they are not expanded or collapsed.|
|IInvokeProvider||Depends||Implement the Invoke control pattern if the tree item can perform a command.|
|IScrollItemProvider||Depends||Implement the ScrollItem control pattern if the tree container supports the Scroll control pattern.|
|ISelectionItemProvider||Depends||Implement the SelectionItem control pattern if it is possible to have an active selection that is maintained when the user returns to the tree container.|
|SelectionContainer||Required||This property exposes the same container for all items within the container.|
The following table lists the UI Automation events that tree item controls are required to support. For more information on events, see UI Automation Events Overview.
|UI Automation Event||Notes|
|UIA_BoundingRectanglePropertyId property-changed event.|
|UIA_ExpandCollapseExpandCollapseStatePropertyId property-changed event.|
|UIA_Invoke_InvokedEventId||If 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_ItemStatusPropertyId property-changed event.||If the control supports the ItemStatus property, it must support this event.|
|UIA_MultipleViewCurrentViewPropertyId property-changed event.||If the control supports the MultipleView control pattern, it must support this event.|
|UIA_NamePropertyId property-changed event.|
|UIA_SelectionItem_ElementAddedToSelectionEventId||If the control supports the SelectionItem control pattern, it must support this event.|
|UIA_SelectionItem_ElementRemovedFromSelectionEventId||If the control supports the SelectionItem control pattern, it must support this event.|
|UIA_SelectionItem_ElementSelectedEventId||If the control supports the SelectionItem control pattern, it must support this event.|
|UIA_ToggleToggleStatePropertyId property-changed event.||If the control supports the Toggle control pattern, it must support this event.|
|UIA_ValueValuePropertyId property-changed event.||If the control supports the Value control pattern, it must support this event.|
If a tree item has subelements other than child outline nodes, the provider must handle the child object information carefully and clearly. In UI Automation, the tree structure is handled by the tree hierarchy itself. By having one or more non-outline-node children, the differences between them and actual child outline nodes becomes seriously ambiguous.