Skip to content

Instantly share code, notes, and snippets.

@wtuts
Last active January 12, 2016 19:48
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/1c8ef3121d7c0675ade2 to your computer and use it in GitHub Desktop.
Save wtuts/1c8ef3121d7c0675ade2 to your computer and use it in GitHub Desktop.
BackKeyPress += OnBackKeyPress;
private void OnBackKeyPress(object sender, CancelEventArgs e)
{
//Code to disable the back button
e.Cancel = true;
//Here you can add your own code and perform any task
var mm = MessageBox.Show("Do you wish to exit the app", "Exit", MessageBoxButton.OKCancel);
if (mm == MessageBoxResult.OK)
{
Application.Current.Terminate();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment