I found basic pages for suspend an app on windows phone 8.1 but I didn't find how to save UI state on suspending. I'm making an audio player app which have in mainpage a grid which I display or not and it contains media buttons, thumbnail, slider etc. When app is forced to suspend itself and I reopen it, it restart like first opening so it lose the app state. How can I save all app state?
0
votes
1 Answers
0
votes
Bind all relevant UI States to some object (aka ViewModel
) and serialize these states upon suspending.
The basic page template also includes methods like SaveState
and LoadState
including a serialized dictionary, where you can store those values.
Another option is to set the page's NavigationCacheMode
to Enabled
or Required
. This will keep the page in memory until your app is terminated.