Reputation: 15237
I am working on a Windows Phone 8.1 (non SL) application.
My app has multiple views, these are Page01.xaml
, Page02.xaml
and Page03.xaml
.
How can I get my app to get back to Page01.xaml
whenever the app is suspended?
So for example, the user is on Page02.xaml
and he is interacting (doing whatever he wants), then he suspends the app. When he gets back to my app, I want him starting at Page01.xaml
instead of where he was!
How can this be achieved?
Upvotes: 0
Views: 40
Reputation: 257
In App.xaml.cs you have method which triggers when app is called from tombstoning. In this method you can remove from RootPage's stack all pages and navigate to Page01.
@edit:
Window.Current.Activated += (sender, eventArgs) =>
{
var rootFrame = Window.Current.Content as Frame;
if (rootFrame.BackStack.Count > 0)
{
rootFrame.BackStack.Clear();
rootFrame.Navigate(typeof(Page01));
}
};
Upvotes: 1