Compartilhar via


Implementando o Padrão Controle Grid de Automação de Interface de Usuário

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.

This topic introduces guidelines and conventions for implementing IGridProvider, including information about properties, methods, and events. Links to additional references are listed at the end of the overview.

The GridPattern control pattern is used to support controls that act as containers for a collection of child elements. The children of this element must implement IGridItemProvider and be organized in a two-dimensional logical coordinate system that can be traversed by row and column. For examples of controls that implement this control pattern, see Mapeamento de Padrão de Controles para Clientes de Automação de IU.

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

  • Implementation Guidelines and Conventions
  • Required Members for IGridProvider
  • Exceptions
  • Tópicos relacionados

Implementation Guidelines and Conventions

When implementing the Grid control pattern, note the following guidelines and conventions:

  • Grid coordinates are zero-based with the upper left (or upper right cell depending on locale) having coordinates (0, 0).

  • If a cell is empty, a UI Automation element must still be returned in order to support the ContainingGrid property for that cell. This is possible when the layout of child elements in the grid is similar to a ragged array (see example below).

Example of a Grid Control with Empty Coordinates

Exibição do Windows Explorer mostrando layout irregular.

  • A grid with a single item is still required to implement IGridProvider if it is logically considered to be a grid. The number of child items in the grid is immaterial.

  • Hidden rows and columns, depending on the provider implementation, may be loaded in the UI Automation tree and therefore will be reflected in the RowCount and ColumnCount properties. If the hidden rows and columns have not yet been loaded, they should not be counted.

  • IGridProvider does not enable active manipulation of a grid; ITransformProvider must be implemented to enable this functionality.

  • Use a StructureChangedEventHandler to listen for structural or layout changes to the grid such as cells that have been added, removed, or merged.

  • Use a AutomationFocusChangedEventHandler to track traversal through the items or cells of a grid.

Required Members for IGridProvider

The following properties and methods are required for implementing the IGridProvider interface.

Required members

Type

Notes

RowCount

Property

None

ColumnCount

Property

None

GetItem

Method

None

This control pattern has no associated events.

Exceptions

Providers must throw the following exceptions.

Exception type

Condition

ArgumentOutOfRangeException

GetItem

  • If the requested row coordinate is larger than the RowCount or the column coordinate is larger than the ColumnCount.

ArgumentOutOfRangeException

GetItem

  • If either of the requested row or column coordinates is less than zero.

Consulte também

Tarefas

Support Control Patterns in a UI Automation Provider

Use Caching in UI Automation

Conceitos

Visão Geral de Padrões de Controle de Automação de Interface de Usuário

Padrões de Controle para Clientes de Automação de IU

Implementando o Padrão Controle de GridItem de Automação de Interface de Usuário

Visão geral da árvore de automação de interface do usuário