This is a similar question to that posed in How to control the scroll position of a ListBox in a MVVM WPF app but, instead, I'm trying to achieve a similar effect from within a Windows Store app: I would like to know how to scroll a ListView to the current (or an arbitrary) item from the view model in an MVVM-style app.
There are a couple of limitations in WinRT when compared to WPF:
- The
IsSynchronizedWithCurrentItemproperty is not supported onListViewor related classes (the property exists but using it throws a runtime exception indicating that it is not currently supported); - There is only partial support for
ICollectionView,CollectionViewSourceand other related types.
Fortunately, the CollectionViewSource problem is elegantly solved by Bernardo Castilho's solution at CodeProject (http://www.codeproject.com/Articles/527686/A-WinRT-CollectionView-class-with-Filtering-and-So). Unfortunately, the lack of support for IsSynchronizedWithCurrentItem makes solving the remainder of the problem tricky.
There are already several similar questions (e.g. Windows 8 Metro style ListView auto scroll) but they don't address the problem from an MVVM perspective and don't allow me to maintain a clean MVVM architecture with a minimum of code-behind in my project.