Retrieving application state when selecting an item in GridView

0

Hello, I'm creating a universal application for Windows 10 in C #. On the home screen you have a GridView loading dozens of items. Would you like to know how to save the selected item without having to go back to the home screen, then scroll to the last item you've seen? Thank you.

    
asked by anonymous 08.06.2016 / 01:37

1 answer

1

Hello.

Just use the Navigation Cache NavigationCacheMode . There are three modes:

NavigationCacheMode = NavigationCacheMode.Disabled - The page is not cached, ie after exiting the screen and returning, the screen will be reset.

NavigationCacheMode = NavigationCacheMode.Enabled - The page will be cached while there is more memory, but if the application needs more memory, it will be released from the cache.

NavigationCacheMode = NavigationCacheMode.Required - The page is cached at all costs, even if there is no more memory available.

Add this to page initialization, right after InitializeComponent()

After this, navigating to the second screen and returning to the home screen will remain unchanged (if you choose the option Required or Enabled ).

Remember that the cache control is done individually on each page. The page 1 cache will not affect page 2.

    
19.06.2016 / 21:48