NavigationService.GoBack() skips a page

357 views Asked by At

I'm using NavigationService.GoBack() to close a page once the user finished his input.

The backstack is printing fine, so I'm sure that all the pages are stored correctly, but calling GoBack() makes it skip a page and I don't know why.

Here's my backstack before calling GoBack()

-----BACKSTACK-----
found /Model;component/TestPage.xaml
found /MainPage.xaml

I expect it to navigate to TestPage.xaml, so I'm checking using this line:

Debug.WriteLine("Navigating to " + NavigationService.BackStack.First().Source);

and here's its output:

Navigating to /Model;component/TestPage.xaml

As I already said, it skips a page so it prints correctly but it navigates to MainPage.xaml.

I've tried with this code instead of GoBack()

NavigationService.Navigate(NavigationService.BackStack.First().Source);

and it seems to work because it navigates to the right page, but it suddenly goes forward, navigating to the page which called that line.

Please keep in mind that TestPage.xaml, and the page from which I'm navigating, are instances of BasePage which extends PhoneApplicationPage.

Does anyone have a clue?


EDIT: Seems like that removing the class that extended PhoneApplicationPage made everything work again. Quite weird anyways, but at least it works!

0

There are 0 answers