Reputation: 5072
I have an application where from the MainPage.xaml I navigate to a page called say two.xaml.
In Two.xaml I then navigate to Three.xaml..
Now for Three.xaml I want to navigate back to the mainPage.Xaml.
In Three.xaml if I do
this.NavigationService.GoBack();
this.NavigationService.GoBack();
I get an InvalidOperationException.
If I do
NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
the system will crate another instance of MainPage.xaml, which I do not want as it will lose its original state.
Anyone have solutions to this issue?
Upvotes: 0
Views: 297
Reputation: 404
If your intent is to navigate in this way: MainPage->PageTwo->PageThree User presses Back Button and goes to MainPage you can use this: NavigationService.RemoveBackEntry() documentation
hope it helps
Upvotes: 0
Reputation: 628
AFAIK, you are not supposed to manipulating the back stack in your app. What cordellcp3 says may be a good idea to implement
Upvotes: 0
Reputation: 3623
you can save the actual state for example in the State-Property of the PhoneApplicationService Class, then Navigate through your pages and when getting back to the MainPage you just implement the OnNavigatedTo()-method of the MainPage and load the State-Data.
Hope this helps...
Upvotes: 2