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

List item controls are an example of controls that implement the ListItem control type.

The following sections define the required UI Automation tree structure, properties, control patterns, and events for the ListItem control type. The UI Automation requirements apply to all list 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 list item 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
ListItem

- Image (0 or more)
- Text (0 or more)
- Edit (0 or more)
ListItem

The children of a list item control within the content view of the UI Automation tree must always be "0". If the structure of the control is such that other items are contained underneath the list item then it should follow the requirements for the UI Automation Support for the TreeItem Control Type control type.

Required UI Automation Properties

The following table lists the UI Automation properties whose value or definition is especially relevant to list item 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. This value of this property should include the area of the image and text contents of the list item.
ClickablePointProperty Depends If the list control has a clickable point (a point that can be clicked to cause the list to take focus) then that point must be exposed through this property. If the list control is completely covered by descendant list items it will raise a NoClickablePointException to indicate that the client must ask an item inside the list control for a clickable point.
NameProperty See notes. The value of a list item control's name property comes from the text contents of the item.
LabeledByProperty See notes. If there is a static text label then this property must expose a reference to that control.
ControlTypeProperty ListItem This value is the same for all UI frameworks.
LocalizedControlTypeProperty "list item" Localized string corresponding to the ListItem control type.
IsContentElementProperty True The list control is always included in the content view of the UI Automation tree.
IsControlElementProperty True The list control is always included in the control view of the UI Automation tree.
IsKeyboardFocusableProperty True If the container can accept keyboard input then this property value should be true.
HelpTextProperty "" The Help text for list controls should explain why the user is being asked to make a choice from a list of options, which is typically the same type of information presented through a tooltip. For example, "Select an item to set the display resolution for your monitor."
ItemTypeProperty Depends This property should be exposed for list item controls that are representing an underlying object. These list item controls typically have an icon associated with the control that users associate with the underlying object.
IsOffscreenProperty Depends This property must return a value for whether the list item is currently scrolled into view within the parent container that implements Scroll control pattern.

Required UI Automation Control Patterns

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

Control Pattern Support Notes
ISelectionItemProvider Yes List item control must implement this control pattern. This allows list items controls to convey when they are selected.
IScrollItemProvider Depends If the list item is contained within a container that is scrollable then this control pattern must be implemented.
IToggleProvider Depends If the list item is checkable and the action does not perform a selection state change then this control pattern must be implemented.
IExpandCollapseProvider Depends If the item can be manipulated to show or hide information then this control pattern must be implemented.
IValueProvider Depends If the item can be edited then this control pattern must be implemented. Changes to the list item control will cause changes to the values of NameProperty, and Value.
IGridItemProvider Depends If item to item spatial navigation is supported within the list container and the container is arranged in rows and columns then the Grid Item control pattern must be implemented.
IInvokeProvider Depends If the item has a command that can be performed on it, separate from selection, then this pattern must be implemented. This is typically an action associated with double-clicking the list item control. Examples would be launching a document from Microsoft Windows Explorer, or playing a music file in Microsoft Windows Media Player.

Required UI Automation Events

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

UI Automation Event Support Notes
InvokedEvent Depends None
ElementAddedToSelectionEvent Required None
ElementRemovedFromSelectionEvent Required None
ElementSelectedEvent Required None
BoundingRectangleProperty property-changed event. Required None
IsOffscreenProperty property-changed event. Required None
IsEnabledProperty property-changed event. Required None
NameProperty Required None
ItemStatusProperty property-changed event. Depends None
ExpandCollapseStateProperty property-changed event. Depends None
ValueProperty property-changed event. Depends None
ToggleStateProperty property-changed event. Depends None
AutomationFocusChangedEvent Required None
StructureChangedEvent Required None

See Also

ListItem
UI Automation Control Types Overview
UI Automation Overview