RadGridView scrolls to the top when copy and paste operations are performed.
The grid scrolls to left when there are a lot of columns as well.
In addition this is only observed when the cell is not in edit mode.
Workaround:
public class MyGridBehavior : BaseGridBehavior
{
public override bool ProcessKey(KeyEventArgs keys)
{
bool isPaste = false;
if (keys.Control && keys.KeyCode == Keys.V && this.GridViewElement.Template.ClipboardCopyMode != GridViewClipboardCopyMode.Disable)
{
if (!(this.GridViewElement.Template.GridReadOnly || this.GridViewElement.Template.ReadOnly))
{
isPaste = true;
}
}
GridTableElement currentTableElement = this.GridViewElement.CurrentView as GridTableElement;
int vScroll = currentTableElement.VScrollBar.Value;
int hScroll = currentTableElement.HScrollBar.Value;
bool result = base.ProcessKey(keys);
if (isPaste)
{
currentTableElement.VScrollBar.Value = vScroll;
currentTableElement.HScrollBar.Value = hScroll;
}
return result;
}
}
this.radGridView1.GridBehavior = new MyGridBehavior();