14

I am developing a Windows 10 UWP app with Visual Studio 2015. I am working on the back button functionality right now. Unfortunately there is a problem. When I press the back button (either on a Phone or on the PC) it doesn't go back to the previous page. When I press it again it works.

It is like this example:

  1. Start App (page 1)
  2. Go to page 2
  3. Go to page 3
  4. Click back button (nothing happens)
  5. Click back button (it goes to page 2)
  6. Click back button (it goes to page 1)

So the first time when you want to go back it needs two presses... why? Additionally I've found out that the first press doesn't trigger the back button event. But why?

I am using the implementation as described in this article: http://www.wintellect.com/devcenter/jprosise/handling-the-back-button-in-windows-10-uwp-apps

XHotSniperX
  • 712
  • 7
  • 25
  • I made a blank app with the code described in your link. For me it's ok. I think you missed something. Can you post your own code please ? – t.ouvre Dec 17 '15 at 09:31

1 Answers1

4

It has to do with SplitView staying open and holding the back event. You should close it if you are using it as overlay.

private void SettingsButton_Click(object sender, RoutedEventArgs e)
{
    this.SplitView.IsPaneOpen = false;
    Frame.Navigate(typeof(SettingsPage));
}
approxiblue
  • 6,982
  • 16
  • 51
  • 59
Dživo Jelić
  • 1,723
  • 3
  • 25
  • 47