How to reproduce: just create a grid with a great number of rows e.g. 15000 and scroll down using the page down key
Workaround:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
BaseGridBehavior gridBehavior = radGridView1.GridBehavior as BaseGridBehavior;
gridBehavior.UnregisterBehavior(typeof(GridViewDataRowInfo));
gridBehavior.RegisterBehavior(typeof(GridViewDataRowInfo), new CustomGridDataRowBehavior());
DataTable dataTable = new DataTable();
dataTable.Columns.Add("Id", typeof(int));
dataTable.Columns.Add("Name", typeof(string));
dataTable.Columns.Add("IsValid", typeof(bool));
for (int i = 0; i < 14000; i++)
{
dataTable.Rows.Add(i, "Name " + i, i % 2 == 0 ? true : false);
}
this.radGridView1.DataSource = dataTable;
this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
}
}
public class CustomGridDataRowBehavior : GridDataRowBehavior
{
protected override bool ProcessPageUpKey(KeyEventArgs keys)
{
GridTableElement tableElement = (GridTableElement)this.GridViewElement.CurrentView;
int index = this.GridViewElement.CurrentRow.Index - tableElement.RowsPerPage + 1;
if (index < 0)
{
index = 0;
}
GridViewRowInfo firstScrollableRow = this.GridControl.Rows[index];
this.GridViewElement.CurrentRow = firstScrollableRow;
return true;
}
protected override bool ProcessPageDownKey(KeyEventArgs keys)
{
GridTableElement tableElement = (GridTableElement)this.GridViewElement.CurrentView;
int index = this.GridViewElement.CurrentRow.Index + tableElement.RowsPerPage - 1;
if (index > this.GridControl.Rows.Count - 1)
{
index = this.GridControl.Rows.Count - 1;
}
GridViewRowInfo lastScrollableRow = this.GridControl.Rows[index];
this.GridViewElement.CurrentRow = lastScrollableRow;
return true;
}
}