IGridProvider.GetItem Method (Int32, Int32)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Retrieves the UI Automation provider for the specified cell.

Namespace:   System.Windows.Automation.Provider
Assembly:  UIAutomationProvider (in UIAutomationProvider.dll)

IRawElementProviderSimple GetItem(
	int row,
	int column


Type: System.Int32

The ordinal number of the row of interest.

Type: System.Int32

The ordinal number of the column of interest.

Return Value

Type: System.Windows.Automation.Provider.IRawElementProviderSimple

The UI Automation provider for the specified cell.

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

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];

.NET Framework
Available since 3.0
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top