private void LoadNextPageIfNeeded() { // If we are less than one page from the end of the currently loaded rows, load the next page int currentRowIndex = gridView.GetDataSourceRowIndex(gridView.FocusedRowHandle); // Get the number of visible rows to pre-fetch the data pages. if (gridVisibleRows == 0) { gridVisibleRows = (gridView.ViewRect.Height / gridView.RowHeight); } if (currentRowIndex + gridVisibleRows > gridView.DataRowCount - 1) { viewModel.ExecuteNextPage(); } }