Skip to content

Instantly share code, notes, and snippets.

@wtuts
Created January 9, 2016 19:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wtuts/e9c3665b075e64b1eeb2 to your computer and use it in GitHub Desktop.
Save wtuts/e9c3665b075e64b1eeb2 to your computer and use it in GitHub Desktop.
public App()
{
this.InitializeComponent();
this.Suspending += this.OnSuspending;
HardwareButtons.BackPressed += HardwareButtons_BackPressed;
}
private void HardwareButtons_BackPressed(object sender, BackPressedEventArgs e)
{
var rootFrame = Window.Current.Content as Frame;
if (rootFrame != null && rootFrame.CanGoBack)
{
e.Handled = true;
rootFrame.GoBack();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment