IGridProvider.GetItem(Int32, Int32) Method

Definition

Retrieves the UI Automation provider for the specified cell.

public:
 System::Windows::Automation::Provider::IRawElementProviderSimple ^ GetItem(int row, int column);
public System.Windows.Automation.Provider.IRawElementProviderSimple GetItem (int row, int column);
abstract member GetItem : int * int -> System.Windows.Automation.Provider.IRawElementProviderSimple
Public Function GetItem (row As Integer, column As Integer) As IRawElementProviderSimple

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.

IRawElementProviderSimple IGridProvider.GetItem(int row, int column)
{
    return (IRawElementProviderSimple)gridItems[row, column];
}
Private Function GetItem(ByVal row As Integer, ByVal column As Integer) As IRawElementProviderSimple Implements IGridProvider.GetItem
    Return CType(gridItems(row, column), IRawElementProviderSimple)
End Function

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

See also