IGridProvider.GetItem(Int32, Int32) Method

Definition

Retrieves the UI Automation provider for the specified cell.

C#
public System.Windows.Automation.Provider.IRawElementProviderSimple GetItem(int row, int column);

Parameters

row
Int32

The ordinal number of the row of interest.

column
Int32

The ordinal number of the column of interest.

Returns

The UI Automation provider for the specified cell.

Examples

The following code is an example implementation of this method that returns an object representing the item at the specified location.

C#
IRawElementProviderSimple IGridProvider.GetItem(int row, int column)
{
    return (IRawElementProviderSimple)gridItems[row, column];
}

Remarks

  • 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 provider 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.

Windows Explorer view showing ragged layout.
Example of a Grid Control with Empty Coordinates

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

Applies to

Produkt Verzie
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

See also