I try to use back button in Windows Phone 8.1 application. When I start the App I'm on page A. Then I go to page B - it works well, but when I go by:
A -> B -> C and click hardware back button app goes to A
also when A -> B -> C -> D and back - also go to A
I used this code to navigate:
Frame.Navigate(typeof(StartingView));
and use this code to implement hardware back button:
HardwareButtons.BackPressed += HardwareButtons_BackPressed;
Frame rootFrame = Window.Current.Content as Frame;
if (rootFrame != null && rootFrame.CanGoBack)
{
rootFrame.GoBack();
e.Handled = true;
}
on page D I list the Frame.BackStack and it looks well. Also when I create button with:
Frame.GoBack();
it goes from D -> C, but when i use the hardware one it goes to A.
Any idea?