List View Item Position

Oct 7, 2014 at 3:37 PM
Hello

I'm using a databound listview in my WinRT (Universal) app and would like to know if this toolkit can help me find what item is currently at the top of the list, (in view) so I can save it and return to this position the next time the app is run!!
Coordinator
Oct 7, 2014 at 3:59 PM
Nope, this functionality is not available..
I think ill add methods to get and restore the scroll position (not top item). But currently i dont have the time.,
Oct 7, 2014 at 4:20 PM
OK, Thanks.

I'm using VisualTreeHelper extension from another toolkit to try and build this functionality.
Oct 8, 2014 at 7:51 AM
Hi, saving/restore scroll position may have odd effect if value is passed between devices. i.e. 500px down on a Win Phone, might not be 500px down on a Win Table?? I'm not sure, just guessing really..
Coordinator
Oct 8, 2014 at 7:53 AM
You are right, in this scenario you need to store an item id... I thought about saving the scroll pos for saving app state for app suspend/resume...
Oct 8, 2014 at 8:57 AM
That's a good idea too!!
Coordinator
Oct 8, 2014 at 3:10 PM
Ok, just created these classes:

http://mytoolkit.codeplex.com/SourceControl/latest#Shared/Utilities/ItemsControlExtensions.cs

Also have a look at these extension methods to get scrolling positions:

http://mytoolkit.codeplex.com/SourceControl/latest#Shared/Utilities/FrameworkElementExtensions.cs

You need to download or clone the latest source code from the "source code" as it is not yet available on NuGet...
Coordinator
Oct 8, 2014 at 3:14 PM
Edited Oct 8, 2014 at 3:17 PM
You also should test the performance of the GetVisibleItems and GetFirstVisibleItem method as I'm not sure how it behaves when having lots of items in a list.