wasteam / waslibs

Windows App Studio WinRT XAML & UWP Libraries
MIT License
314 stars 133 forks source link

ResponsiveGriView maintain scroll position #27

Closed alexandredsimoes closed 8 years ago

javitosanchez commented 8 years ago

Could you describe more your requirement?

alexandredsimoes commented 8 years ago

In a ResponsiveGriView with many items when I navigate to another page and come back, the Grid returns to the first item in the list and not in the position it was before going to that new page.

The ResponsiveGriView should have a property to set the SelectedItem to make it possible to set the item position explicitly.

Congratulations on fantastic job.

javitosanchez commented 8 years ago

This property shouldn't solve your problem because, even with it, you'll have to maintain the state of your page. Our recommendation is to use the NavigationCacheMode page property. You can set to required or enabled depending on your device memory requirements. Read this for the usage

Also, in order to handle your page state, you can use the NavigationMode of the NavigationEventArgs parameter in the OnNavigatedTo method. For example, if the value is NavigationMode.New you can restore your state, but if it's NavigationMode.Back do nothing and let the system to handle by cache.

alexandredsimoes commented 8 years ago

Ok, NavigationCacheMode works for me. Thanks for the tip. ;-)