Export (0) Print
Expand All
Expand Minimize

UI Automation Support for the DataGrid Control Type

This topic provides information about Microsoft UI Automation support for the DataGrid control type. In UI Automation, a control type is a set of conditions that a control must meet in order to use the ControlType property. The conditions include specific guidelines for UI Automation tree structure, UI Automation property values and control patterns.

The DataGrid control type lets a user easily work with items that contain metadata represented in columns. Data grid controls have rows of items and columns of information about those items. A List View control in Microsoft Vista Explorer is an example that supports the DataGrid control type.

The following sections define the required UI Automation tree structure, properties, control patterns, and events for the DataGrid control type. The UI Automation requirements apply to all data grid controls, whether Windows Presentation Foundation (WPF), Win32, or Windows Forms.

This topic contains the following sections.

The following table depicts the control view and the content view of the UI Automation tree that pertains to data grid controls and describes what can be contained in each view. For more information about the UI Automation tree, see UI Automation Tree Overview.

UI Automation Tree - Control View

UI Automation Tree - Content View

  • DataGrid

    • Header

    • HeaderItem (child of Header)

    • DataItem

  • DataGrid

    • DataItem

The following table lists the properties whose value or definition is especially relevant to data grid controls. For more information on UI Automation properties, see UI Automation Properties for Clients.

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.

Supported if there is a bounding rectangle. If not every point within the bounding rectangle is clickable, and you perform specialized hit testing, then override and provide a clickable point.

ControlTypeProperty

DataGrid

This value is the same for all UI frameworks.

IsContentElementProperty

True

The value of this property must always be True. This means that the data grid control must always be in the content view of the UI Automation tree.

IsControlElementProperty

True

The value of this property must always be True. This means that the data grid control must always be 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 there is a static text label then this property must expose a reference to that control.

LocalizedControlTypeProperty

"data grid"

Localized string corresponding to the DataGrid control type.

NameProperty

See notes.

The data grid control typically gets the value for its Name property from a static text label. If there is not a static text label an application developer must assign a value to for the Name property. The value of the Name property must never be the textual contents of the edit control.

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

Control Pattern Interface

Support/Value

Notes

IGridProvider

Yes

The data grid control itself always supports the Grid control pattern because the items that it contains have metadata that is laid out in a grid.

IScrollProvider

Depends

The ability to scroll the data grid depends on content and whether scroll bars are present.

ISelectionProvider

Yes

All data grid controls contain items within it that are selectable.

ITableProvider

Yes

The data grid control always has a header within its subtree so the Table control pattern must be supported.

Data item controls within the data grid containers will support at a minimum:

  • Selection Item control pattern

  • Scroll Item control pattern (if container is scrollable)

The items within the data item container will support at a minimum:

  • Grid Item control pattern

  • Table Item control pattern

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

UI Automation Event

Support/Value

Notes

AutomationFocusChangedEvent

Required

None

BoundingRectangleProperty property-changed event.

Required

None

IsEnabledProperty property-changed event.

Required

None

IsOffscreenProperty property-changed event.

Required

None

LayoutInvalidatedEvent

Depends

None

StructureChangedEvent

Required

None

CurrentViewProperty property-changed event.

Depends

None

HorizontallyScrollableProperty property-changed event.

Depends

If the control supports the Scroll pattern, it must support this event.

HorizontalScrollPercentProperty property-changed event.

Depends

If the control supports the Scroll pattern, it must support this event.

HorizontalViewSizeProperty property-changed event.

Depends

If the control supports the Scroll pattern, it must support this event.

VerticalScrollPercentProperty property-changed event.

Depends

If the control supports the Scroll pattern, it must support this event.

VerticallyScrollableProperty property-changed event.

Depends

If the control supports the Scroll pattern, it must support this event.

VerticalViewSizeProperty property-changed event.

Depends

If the control supports the Scroll pattern, it must support this event.

InvalidatedEvent

Required

None

The following image illustrates a List View control that implements the DataGrid control type.

Graphic of a List View control with two data items

The control view and the content view of the UI Automation tree that pertains to the List View control is displayed below. The control patterns for each automation element are shown in parentheses.

UI Automation Tree - Control View

UI Automation Tree - Content View

DataGrid (Sort, Table, Selection, Grid)

  • Header

    • HeaderItem "Name" (Invoke)

    • HeaderItem "Date Modified" (Invoke)

    • HeaderItem "Size" (Invoke)

  • Group "Contoso"

    • DataItem "Accounts Receivable.doc" (SelectionItem, Invoke)

    • DataItem "Accounts Payable.doc" (SelectionItem, Invoke)

DataGrid (Sort, Table, Selection, Grid)

  • Group "Contoso"

    • DataItem "Accounts Receivable.doc" (SelectionItem, Invoke)

    • DataItem "Accounts Payable.doc" (SelectionItem, Invoke)

The Data Item automation element can have the following children: Edit, Image, and Text.

Show:
© 2014 Microsoft