RadGridView scroll position reset after Rebind()

2 posts, 0 answers
  1. Michael Pawelek
    Michael Pawelek avatar
    1 posts
    Member since:
    Apr 2006

    Posted 07 Oct 2015 Link to this post

    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);

     

     

     

  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 12 Oct 2015 Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top