This is a migrated thread and some comments may be shown as answers.

RadGridView scroll position reset after Rebind()

1 Answer 821 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Michael Pawelek
Top achievements
Rank 1
Michael Pawelek asked on 07 Oct 2015, 12:50 PM

Hello,

I am attempting to retain the position of the scroll position of the RadGridView depending on the action being performed by the user during a ReBind() event.  I found a solution presented already before but I am having problems implementing it: http://www.telerik.com/forums/scrollviewer-in-radgridview.  It only seems to work intermittently.  Even though the contents and row count are not changing, sometimes the scroll stays perfectly still as expected, sometimes nudges slightly, sometimes jumps 5-10 rows losing focus on whatever the user was doing and confusing them.  Oddly it always seems to work on subsequent Rebind() events unless the user adjusts the scroll position again and the problem begins to repeat.  Is there anything that can be done to prevent or fix this unpredictable ​behavior?

 

var scrollViewer = this.radGridView.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault();
//Get horizontal and vertical offsets
var horizontalOffset = scrollViewer.HorizontalOffset;
var verticalOffset = scrollViewer.VerticalOffset;
     
//Set horizontal and vertical offsets   
scrollViewer.ScrollToHorizontalOffset(horizontalOffset);
scrollViewer.ScrollToVerticalOffset(verticalOffset);

 

 

 

1 Answer, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 12 Oct 2015, 12:12 PM
Hello,

Can you please confirm in which situations you need to invoke Rebind()? Are you referring to the RadGridView.Rebind() method or to CollectionChanged.Reset? Generally, using this method suggests that some drastic changes in the bound data sources have occurred and a full reset of the data engine is needed. I am afraid that maintaining focus in a certain element would not be possible as the whole UI would be recreated almost from scratch. 

Regards,
Ivan Ivanov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
GridView
Asked by
Michael Pawelek
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Share this question
or