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

Maintain scroll position on treelistview page navigation

1 Answer 93 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Vinod
Top achievements
Rank 1
Vinod asked on 05 Dec 2011, 02:55 PM
  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.

1 Answer, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 08 Dec 2011, 08:36 AM
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 >>

Tags
TreeListView
Asked by
Vinod
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Share this question
or