Maintain scroll position on treelistview page navigation

2 posts, 0 answers
  1. Vinod
    Vinod avatar
    16 posts
    Member since:
    Nov 2011

    Posted 05 Dec 2011 Link to this post

      Hi,

    I need to maintain scroll position (both horizontal and vertical) when moving across pages.
    I tried the following code , but was unable to achieve the desired functionality.
    Even after calling RestoreScrollPosition() the scrollviewer didn't change its position.




    private void btnNext_Click(object sender, RoutedEventArgs e)



    {

    SetScrollPosition();
    BindData();

    RestoreScrollPosition();







    }







    private void SetScrollPosition()



    {



    GridViewScrollViewer svSummaryInfo = (GridViewScrollViewer)rtSummaryInfo.FindChildByType<GridViewScrollViewer>();








    _dbVerticalOffset = svSummaryInfo.VerticalOffset;
    _dbHorizontalOffset = svSummaryInfo.HorizontalOffset;
    }




    private



    void RestoreScrollPosition()



    {


    GridViewScrollViewer



    svSummaryInfo = (GridViewScrollViewer)rtSummaryInfo.FindChildByType<GridViewScrollViewer>();





    if (svSummaryInfo != null)



    {



    svSummaryInfo.ScrollToHorizontalOffset(_dbHorizontalOffset);

    svSummaryInfo.ScrollToVerticalOffset(_dbVerticalOffset);

    }
    }

    Please provide a code snippet for the same.
  2. Nedyalko Nikolov
    Admin
    Nedyalko Nikolov avatar
    871 posts

    Posted 08 Dec 2011 Link to this post

    Hi Vinod,

    You can take a look at this help topic about more information how to scroll to a particular item (or item index) and column (which in fact is a cell).

    Greetings,
    Nedyalko Nikolov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top