Completed
Last Updated: 21 Jul 2015 15:43 by Svetlin
Svetlin
Created on: 05 Nov 2012 05:12
Category: GridView
Type: Bug Report
2
FIX. RadGridView - scrolls to the top/left when copy and paste operations are performed.
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();
0 comments