/// <summary> /// To find the first/last error cell in view if selection is not maintained in datagrid. /// </summary> private void MoveToErrorCell(SfDataGrid datagrid, bool MoveToFirstCell, ref bool moveToRow) { RowColumnIndex rowColumnIndex; if (MoveToFirstCell) { rowColumnIndex = new RowColumnIndex(datagrid.GetFirstDataRowIndex(), datagrid.GetFirstColumnIndex()); } else { rowColumnIndex = new RowColumnIndex(datagrid.GetLastDataRowIndex(), datagrid.GetLastColumnIndex()); } datagrid.SelectionController.MoveCurrentCell(rowColumnIndex); var currentRowColumnIndex = datagrid.SelectionController.CurrentCellManager.CurrentRowColumnIndex; var gridCellCollections = GetGridCellCollection(datagrid, currentRowColumnIndex); if (gridCellCollections != null) { foreach (var gridCellItem in gridCellCollections) { var gridCell = gridCellItem as GridCell; if (gridCell != null && gridCell.HasError && gridCell.ColumnBase.ColumnIndex == currentRowColumnIndex.ColumnIndex) { datagrid.SelectionController.MoveCurrentCell(new RowColumnIndex(currentRowColumnIndex.RowIndex, gridCell.ColumnBase.ColumnIndex)); datagrid.ScrollInView(datagrid.SelectionController.CurrentCellManager.CurrentRowColumnIndex);; moveToRow = false; return; } } } }