Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>(I've edited previous answer instead of adding a new one)<BR> I've spend a little time trying to find a solution, and I don't see why your code doesn't run. In my case it's enough if I do such a change in App.xaml:</p> <pre><code> private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e) { // Set the root visual to allow the application to render if (RootVisual != RootFrame) RootVisual = RootFrame; // Remove this handler since it is no longer needed RootFrame.Navigated -= CompleteInitializePhoneApplication; App.RootFrame.Navigate(new Uri("/passPage.xaml", UriKind.RelativeOrAbsolute)); } </code></pre> <p>This works on my example which is under the link <a href="http://sdrv.ms/1ajH40E" rel="nofollow noreferrer">http://sdrv.ms/1ajH40E</a> <BR>But - I cannot prevent user from seeing last screen when he holds back buton and is chosing to which app return, and then for a blink he can see the last page before leaving the app. <BR>I don't know if it is possible to change this behaviour after clicking MS Button:<br> <a href="https://stackoverflow.com/questions/16299491/windows-phone-change-deactivated-app-image">windows phone change deactivated app image</a></p> <p><strong>Second edit</strong><br> Ok - maybe I've found solution why it sometiems work and sometimes not in your code. After pressing the Start or Search buton the App can go to two cases: Tombstone and non-tombsone. After return different events happen. Code above works with Tombstone case but not with non-tombstone. To work it with the second you need to add (because page is not initialized again) - (of course it can be different solution): <BR></p> <pre><code> bool afterActivation = false; private void Application_Activated(object sender, ActivatedEventArgs e) { afterActivation = true; } private void CheckForResetNavigation(object sender, NavigationEventArgs e) { // If the app has received a 'reset' navigation, then we need to check // on the next navigation to see if the page stack should be reset if (e.NavigationMode == NavigationMode.Reset) RootFrame.Navigated += ClearBackStackAfterReset; if (afterActivation) { afterActivation = false; App.RootFrame.Navigate(new Uri("/passPage.xaml", UriKind.RelativeOrAbsolute)); } } </code></pre> <p>Please also ensure of your debug properties in VS: Project->Properties->Debug->Tombstone upon deactiovation checkbox.<br> You can also find some information here (if you haven't seen it before):<br> <a href="http://blogs.msdn.com/b/ptorr/archive/2010/12/11/how-to-correctly-handle-application-deactivation-and-reactivation.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/b/ptorr/archive/2010/12/11/how-to-correctly-handle-application-deactivation-and-reactivation.aspx</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload