/// <summary> /// Gets a specific data cell from the DataGrid. (Without headers.) /// </summary> /// <param name="rowIndex">The row index the item belongs to. Starting at 0.</param> /// <param name="columnIndex">The column index the item belongs to. Starting at 0.</param> /// <returns>The specific data cell item.</returns> /// <exception cref="IndexOutOfRangeException">The row and header index needs to be inside the Range of BasicDataGrid.ColumnCount and BasicDataGrid.RowCount.</exception> public BasicDataCell GetItem(int rowIndex, int columnIndex) { if (rowIndex < 0 || rowIndex > RowCount - 1) { throw new IndexOutOfRangeException("The row index was outside the range of BasicDataGrid.RowCount"); } if (columnIndex < 0 || columnIndex > ColumnCount - 1) { throw new IndexOutOfRangeException("The row index was outside the range of BasicDataGrid.ColumnCount"); } var pattern = Patterns.GetGridPattern(AutomationElement); return(new BasicDataCell(pattern.GetItem(rowIndex, columnIndex))); }
/// <summary> /// Returns the BasicElement from the cell. /// </summary> /// <param name="row">The item row.</param> /// <param name="column">The item column.</param> /// <returns>The BasicElement.</returns> /// <remarks>Not supported for a ListBox.</remarks> public BasicElement GetItem(int row, int column) { var pattern = Patterns.GetGridPattern(AutomationElement); return(new BasicElement(pattern.GetItem(row, column))); }