Compartilhar via


UI Automation Support for the DataGrid Control Type

Observação

Esta documentação destina.Os desenvolvedores do NET Framework que desejam usar o gerenciado UI Automation classes definidas na System.Windows.Automation namespace.As informações mais recentes sobre UI Automation, consulte API de automação do Windows: Automação da interface do usuário.

Este tópico fornece informações sobre Microsoft UI Automation suporte para a DataGrid o tipo de controle. In UI Automation, a control type is a set of conditions that a control must meet in order to use the ControlType property. As condições incluem as diretrizes específicas para UI Automation estrutura de árvore, UI Automation os valores de propriedade e padrões de controle.

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.

Este tópico contém as seguintes seções.

  • Required UI Automation Tree Structure
  • Required UI Automation Properties
  • Required UI Automation Control Patterns
  • Required UI Automation Events
  • Date Grid Control Type Example
  • Tópicos relacionados

Required UI Automation Tree Structure

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 Visão geral da árvore de automação de interface do usuário.

UI Automation Tree - Control View

UI Automation Tree - Content View

DataGrid

  • Cabeçalho (0, 1 ou 2)

    • HeaderItem (número de colunas ou linhas)

  • DataItem (0 ou mais; podem ser estruturados na hierarquia)

DataGrid

  • DataItem (0 ou mais; podem ser estruturados na hierarquia)

Required UI Automation Properties

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.

Required UI Automation Control Patterns

The following table lists the control patterns required to be supported by all data grid controls. For more information about control patterns, see Visão Geral de Padrões de Controle de Automação de Interface de Usuário.

Padrão de controle

Support

Notes

IGridProvider

Yes

O próprio controle de grade de dados sempre suporta o padrão de controle de grade, porque os itens que ele contém metadados dispostos em uma grade.

IScrollProvider

Depends

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

ISelectionProvider

Depends

A capacidade de selecionar a grade de dados depende do conteúdo.

ITableProvider

Yes

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

Os itens de dados dentro de recipientes de grade de dados compatível com no mínimo:

  • Padrão de controle de Item de seleção (se a grade de dados é selecionável)

  • Role o padrão de controle de Item (se a grade de dados for rolável)

  • Grid Item control pattern

  • Table Item control pattern

Required UI Automation Events

The following table lists the UI Automation events required to be supported by all data grid controls. For more information about events, see Visão geral sobre eventos de automação de interface do usuário.

UI Automation Event

Support

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

Date Grid Control Type Example

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

Gráfico de um controle List View com dois itens de dados

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 (tabela, a grade, seleção)

  • Header

    • HeaderItem "Name" (Invoke)

    • HeaderItem "Date Modified" (Invoke)

    • HeaderItem "Size" (Invoke)

  • Grupo "Contoso" (Item de tabela, GridItem, SelectionItem, tabela * grade *)

    • DataItem "Contas Receivable.doc" (SelectionItem, invocar, item de tabela * GridItem *)

    • DataItem "Contas Payable.doc" (SelectionItem, invocar, item de tabela * GridItem *)

  • DataGrid (tabela, a grade, seleção)

  • Grupo "Contoso" (Item de tabela, GridItem, SelectionItem, tabela * grade *)

    • DataItem "Contas Receivable.doc" (SelectionItem, invocar, item de tabela * GridItem *)

    • DataItem "Contas Payable.doc" (SelectionItem, invocar, item de tabela * GridItem *)

* O exemplo anterior mostra um DataGrid que contém vários níveis de controles. O controle de grupo ("Contoso") contém dois controles de DataItem ("contas Receivable.doc" "contas e Payable.doc"). Um par de DataGrid/GridItem independe de um par de outro nível. Os controles DataItem em um grupo também podem ser expostos como um tipo de controle ListItem, permitindo que eles sejam apresentados mais claramente como selecionáveis objetos, em vez de como os elementos de dados simples. Este exemplo não inclui os subelementos dos itens de dados agrupados.

Consulte também

Referência

DataGrid

Conceitos

Visão Geral dos Tipos de Controle de Automação de Interface do Usuário

UI Automation Overview