UI Automation Support for the Tree 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 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.

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 ViewContent 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).

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 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.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.
ControlTypePropertyTreeThis value is the same for all UI frameworks.
IsContentElementPropertyTrueThe tree control is always included in the content view of the UI Automation tree.
IsControlElementPropertyTrueThe tree control is always included in the control view of the UI Automation tree.
IsKeyboardFocusablePropertySee notes.If the control can receive keyboard focus, it must support this property.
LabeledByPropertySee 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.
NamePropertySee 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.

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 PropertySupport/ValueNotes
ISelectionProviderDependsTree 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.
CanSelectMultipleSee notes.Implement this property if the tree control supports multiple selection (most tree controls do not support multiple selection).
IsSelectionRequiredSee notes.The value of this property is exposed if the control requires that an item be selected.
IScrollProviderDependsImplement this control pattern if the contents of the tree container can be scrolled.

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 EventSupportNotes
InvalidatedEventDependsNone
BoundingRectangleProperty property-changed event.RequiredNone
IsOffscreenProperty property-changed event.RequiredNone
IsEnabledProperty property-changed event.RequiredNone
HorizontallyScrollableProperty property-changed event.DependsNone
HorizontalScrollPercentProperty property-changed event.DependsNone
HorizontalViewSizeProperty property-changed event.DependsNone
VerticalScrollPercentProperty property-changed event.DependsNone
VerticallyScrollableProperty property-changed event.DependsNone
VerticalViewSizeProperty property-changed event.DependsNone
AutomationFocusChangedEventRequiredNone
StructureChangedEventRequiredNone

Tree
UI Automation Control Types Overview
UI Automation Overview

Show: