Hi I have this hierarchy
App (RootFrame)
And I want to handle Back button correctly. Navigating between pages in inner frames is ok, but when I go for example from "List Page with entities 2" to "Detail page for entity 2" and then back, MainShell i recreated and forgets the InnerFrames BackStack and opened Page(should be "List Page with entities 2")
Is there any elegant way to handle this? for example save InnerFrames history and current page when navigatedFrom at MainShell happens?
You can try Prism Framework , here is a lifecycle managing example .
In a nutshell Prism provides SessionStateService
to manage view restoring when OnAppSuspended
and OnAppResumed
events invoked.
Also Prism NavigationService
passes NavigatedToEventArgs e, NavigatedFromEventArgs e, Dictionary<string, object> viewModelState
parameters and your page behaviour can be overrided in OnNavigatedTo
and OnNavigatedFrom
using this parameters.
I found what I needed. There are SetNavigationState(string) and GetNavigationState() methods on Frame object. Thanks anyway
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.