DataItem Control Type
This topic provides information about Microsoft UI Automation support for the DataItem control type.
An entry in a Contacts list is an example of a data item control. A data item control contains information that is of interest to an end user. It is more complicated than the simple list item because it contains richer information.
The following sections define the required UI Automation tree structure, properties, control patterns, and events for the DataItem control type. The UI Automation requirements apply to all data item controls, whether Windows Presentation Foundation (WPF), Microsoft Win32, or Windows Forms.
This topic contains the following sections.
- Typical Tree Structure
- Relevant Properties
- Required Control Patterns
- Working with DataItems in Large Lists
- Required Events
- DataItem Control Type Example
- Related topics
The following table depicts a typical control and content view of the UI Automation tree that pertains to data 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|
A data item element in a data grid can host a variety of objects, including another layer of data items, or specific grid elements such as text, images, or edit controls. If the data item element has a specific object role, the element should be exposed as a specific control type; for example, a ListItem control type for a selectable data item in the grid.
The following table lists the UI Automation properties whose value or definition is especially relevant to the DataItem 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.||Supported if there is a bounding rectangle. If not every point within the bounding rectangle is clickable, and the element performs specialized hit testing, override and provide a clickable point.|
|UIA_IsContentElementPropertyId||TRUE||The data item control must always be content.|
|UIA_IsControlElementPropertyId||TRUE||The data item control must always be a control.|
|UIA_IsKeyboardFocusablePropertyId||See notes.||If the control can receive keyboard focus, it must support this property.|
|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.||This is the string value that conveys to the end user the underlying object that the item represents. Examples include "Media File" and "Contact".|
|UIA_LabeledByPropertyId||Null||Data item controls do not have a static text label.|
|UIA_LocalizedControlTypePropertyId||See notes.||Localized string corresponding to the DataItem control type. The default value is "data item" for en-US or English (United States).|
|UIA_NamePropertyId||See notes.||The data item control always contains a primary text element that the user would recognize as the identifier for the item.|
The following table lists the UI Automation control patterns required to be supported by all data item controls. For more information on control patterns, see UI Automation Control Patterns Overview.
|IExpandCollapseProvider||Depends||If the data item can be expanded or collapsed to show and hide information, the ExpandCollapse control pattern must be supported.|
|IGridItemProvider||Depends||Data items will support the GridItem control pattern when a collection of data items is available within a container that can be spatially navigated item-to-item.|
|IScrollItemProvider||Depends||All data items support the ability to be scrolled into view with the ScrollItem control pattern when their data container has more items than can fit on the screen.|
|ISelectionItemProvider||Depends||The ability to select the data items depends on the content.|
|ITableItemProvider||Depends||If the data item is contained within a DataGrid control type that has a header element, it should support the TableItem control pattern.|
|IToggleProvider||Depends||If the data item contains a state that can be cycled through, it should support the Toggle control pattern.|
|IValueProvider||Depends||If the data item's primary text is editable, the Value control pattern must be supported.|
Because large lists are often virtualized within UI frameworks to assist in performance, a UI Automation client cannot use the UI Automation query feature to search the contents of the full tree in the same way that it can in other item containers. A client should scroll the item into view (or expand the control to show all available options) prior to accessing the full set of information from the data item.
When calling SetFocus on the UI Automation element for the data item, Microsoft Windows Explorer returns successfully and causes focus to be set to the Edit control within the data item subtree.
The following table lists the UI Automation events that data 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.||If the control supports the ExpandCollapse control pattern, it must support this 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_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.|
The following image illustrates a DataItem control type in a list-view control.
The control view and the content view of the UI Automation tree that pertains to the data item control is displayed below. The control patterns for each automation element are shown in parentheses. The Group "Contoso" is also part of the grid of the data grid host control. For an example of a higher level grid structure, see DataGrid Control Type.
|UI Automation Tree - Control View||UI Automation Tree - Content View|
If a grid represents a list of selectable items, the corresponding selectable UI elements can be exposed with the ListItem control type instead of the DataItem control type. In the preceding example, the DataItem elements ("Accounts Receivable.doc" and "Accounts Payable.doc") under Group ("Contoso") can be improved by exposing them as ListItem control types because that type already supports the SelectionItem control pattern.
Build date: 5/16/2013