With the latest update to the Windows Phone Toolkit they have overhauled the internals of the LongListSelector for the Mango release. One of the changes was removing suppor
The Link/Unlink approach does not work at all for restoring the scroll position. Even if you setup the collection, you don't know if you are scrolling up or down, and the size of the collection would vary depending on the BufferSize
property of the LongListSelector
.
The FindScrollViewer
solution in kvakulo's answer, however, works.
If someone needs the VB.Net version of this code:
Friend Function FindScrollViewer(parent As DependencyObject) As ScrollViewer
Dim childCount = VisualTreeHelper.GetChildrenCount(parent)
For i As Int32 = 0 To childCount - 1
Dim elt = VisualTreeHelper.GetChild(parent, i)
If elt.GetType Is GetType(ScrollViewer) Then Return CType(elt, ScrollViewer)
Dim result = FindScrollViewer(elt)
If result IsNot Nothing Then Return result
Next
Return Nothing
End Function