Asked by:
Gridview remember scroll position

Question
-
Hi, i have gridview with over 100 items, after clicking one of the items the gridview scroll is restored to the beginning isntead of where i was. how can i retain the position of the gridview?Thursday, January 29, 2015 4:05 AM
All replies
-
Hi,
i think here is what you want:
Regards, Markus
Friday, January 30, 2015 12:10 AM -
i'm using Visual Basic and i have converted that code to VB and it gives me lot of errors.Sunday, February 1, 2015 1:35 PM
-
Hi Jay_P85,
GridView.ScrollIntoView method helps you move scrollbar to special object in GridView. Use OnNavigatedFrom event handler to remember the scrollview position, save it in LocalSettings. In OnNavigatedTo event handler, use ScrollIntoView method with position object in LocalSettings.
I am not familiar with VB.NET, hope the following code snippet can help you.
Protected Overrides Sub OnNavigatedTo(e As NavigationEventArgs) Dim t As Item = DirectCast(ApplicationData.Current.LocalSettings.Values("scroll"), Item) FlavorGrid.ScrollIntoView(t) End Sub Protected Overrides Sub OnNavigatedFrom(e As NavigationEventArgs) Dim t As Item = DirectCast(storeData.Collection.LastOrDefault(), Item) ApplicationData.Current.LocalSettings.Values.Clear() ApplicationData.Current.LocalSettings.Values.Add("scroll", scrollItem) End Sub
Regards,
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.
- Proposed as answer by Herro wongMicrosoft contingent staff, Moderator Monday, February 9, 2015 2:13 AM
- Marked as answer by Herro wongMicrosoft contingent staff, Moderator Tuesday, February 10, 2015 8:44 AM
- Unmarked as answer by Jay_P85 Sunday, February 22, 2015 12:09 PM
Friday, February 6, 2015 2:52 AMModerator -
Hi, when i try that code i get the following errors.
Thanks for your help.
Tuesday, February 10, 2015 10:24 PM