Tree Control Type

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

The Tree control type is used for containers whose contents have relevance as a hierarchy of nodes, as with the way files and folders are displayed in the left pane of Windows Explorer. Each node has the potential to contain other nodes, called child nodes. Parent nodes, or nodes that contain child nodes, can be displayed as expanded or collapsed. The Windows tree-view control (as identified by WC_TREEVIEW) is an example of a control that belongs to the Tree control type.

The following sections define the required UI Automation tree structure, properties, control patterns, and events for the Tree 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

The following table depicts a typical control and content view of the UI Automation tree that pertains to tree 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
    • DataItem (0 or more)
    • TreeItem (0 or more)
      • TreeItem (0 or more)
        • ...
    • ScrollBar (0, 1, 2)
  • Tree
    • DataItem (0 or more)
    • TreeItem (0 or more)
      • TreeItem (0 or more)
        • ...

 

The control view of the UI Automation tree consists of:

  • Zero of many items within the container (items can be based on the TreeItem or DataItem control types).
  • Zero, one, or two scroll bar controls

The content view of the UI Automation tree consists of zero or many items within the container (items can be based on the TreeItem or DataItem control types).

Relevant Properties

The following table lists the UI Automation properties whose value or definition is especially relevant to the Tree 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. Tree controls have a clickable point that causes the tree or one of the items in the tree container to receive the focus. A tree control can have a clickable point only if it is possible to click a location in the tree without causing an item to be selected or to receive the focus.
UIA_ControlTypePropertyId Tree This value is the same for all UI frameworks.
UIA_IsContentElementPropertyId TRUE The tree control is always included in the content view of the UI Automation tree.
UIA_IsControlElementPropertyId TRUE The tree 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_LabeledByPropertyId See notes. If the tree control has a label associated with it, this property returns a IUIAutomationElement pointer for that label. Otherwise, the property returns a null reference.
UIA_LocalizedControlTypePropertyId See notes. Localized string corresponding to the Tree control type. The default value is "tree" for en-US or English (United States).
UIA_NamePropertyId See notes. The value of a tree control's name property usually comes from text that labels the control. If there is no text label, you must provide a value for this property.

 

Required Control Patterns

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

Control Pattern/Pattern Property Support/Value Notes
IScrollProvider Depends Implement the Scroll control pattern if items in the tree container can be scrolled.
ISelectionProvider Depends Tree controls that contain a set of selectable items must implement the Selection control pattern. It need not be implemented if selecting an item conveys no meaningful information to the user.
CanSelectMultiple See notes. Implement this property if the tree control supports multiple selection (most tree controls do not support multiple selection).
IsSelectionRequired See notes. The value of this property is exposed if the control requires that an item be selected.

 

Required Events

The following table lists the UI Automation events that all tree controls must 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_ScrollHorizontallyScrollablePropertyId property-changed event. If the control supports the Scroll control pattern, it must support this event.
UIA_ScrollHorizontalScrollPercentPropertyId property-changed event. If the control supports the Scroll control pattern, it must support this event.
UIA_ScrollHorizontalViewSizePropertyId property-changed event. If the control supports the Scroll control pattern, it must support this event.
UIA_ScrollVerticalScrollPercentPropertyId property-changed event. If the control supports the Scroll control pattern, it must support this event.
UIA_ScrollVerticallyScrollablePropertyId property-changed event. If the control supports the Scroll control pattern, it must support this event.
UIA_ScrollVerticalViewSizePropertyId property-changed event. If the control supports the Scroll control pattern, it must support this event.
UIA_Selection_InvalidatedEventId If the control supports the Selection control pattern, it must support this event.
UIA_StructureChangedEventId

 

Conceptual

UI Automation Control Types Overview

UI Automation Overview