UI Automation Support for the Tree Control Type

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 Tree 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.

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 Microsoft 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 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 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 tree 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
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 to many items within the container (items can be based on the Tree Item, Data Item, or other control type).

  • Zero, one or two scroll bars.

The content view of the UI Automation tree consists of zero or many items within the container (items can be based on the Tree Item, Data Item, or other control type).

Required UI Automation Properties

The following table lists the UI Automation properties whose value or definition is especially relevant to list controls. For more information about 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. Tree controls have a clickable point that will cause the tree or one the items in the tree container to have the focus set on them. You get a clickable point for a tree only if you can click somewhere that doesn't cause one of the items to be selected/get focus.
ControlTypeProperty Tree This value is the same for all UI frameworks.
IsContentElementProperty True The tree control is always included in the content view of the UI Automation tree.
IsControlElementProperty True The tree control is always included in the control view of the UI Automation tree.
IsKeyboardFocusableProperty See notes. If the control can receive keyboard focus, it must support this property.
LabeledByProperty See notes. If the tree control has a label associated with it, this property will return an AutomationElement for that label. Otherwise, the property will return a null reference (Nothing in Microsoft Visual Basic .NET).
LocalizedControlTypeProperty "tree" Localized string corresponding to the List control type.
NameProperty 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, then the application developer must provide a value for this property.

Required UI Automation Control Patterns

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

Control Pattern/Pattern Property Support/Value Notes
ISelectionProvider Depends Tree controls that contain a set of selectable items must implement this control pattern. This control pattern does not have to be implemented if selecting an item does not convey 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.
IScrollProvider Depends Implement this control pattern if the contents of the tree container can be scrolled.

Required UI Automation Events

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

UI Automation Event Support Notes
InvalidatedEvent Depends None
BoundingRectangleProperty property-changed event. Required None
IsOffscreenProperty property-changed event. Required None
IsEnabledProperty property-changed event. Required None
HorizontallyScrollableProperty property-changed event. Depends None
HorizontalScrollPercentProperty property-changed event. Depends None
HorizontalViewSizeProperty property-changed event. Depends None
VerticalScrollPercentProperty property-changed event. Depends None
VerticallyScrollableProperty property-changed event. Depends None
VerticalViewSizeProperty property-changed event. Depends None
AutomationFocusChangedEvent Required None
StructureChangedEvent Required None

See also