Gridview remember scroll position RRS feed

  • 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

  • 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)
        End Sub
        Protected Overrides Sub OnNavigatedFrom(e As NavigationEventArgs)
            Dim t As Item = DirectCast(storeData.Collection.LastOrDefault(), Item)
            ApplicationData.Current.LocalSettings.Values.Add("scroll", scrollItem)
    End Sub


    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.

    Friday, February 6, 2015 2:52 AM
  • Hi, when i try that code i get the following errors.

    Thanks for your help.

    Tuesday, February 10, 2015 10:24 PM