Windows Phone 7 : Handling Hardware Back Button
Often user presses hardware back button while inside an application. This would send the existing application to the background and let other be on top. Most of the times this is acceptable but sometimes application requires user to choose whether to go back or notify about it. Handling back button through code,
protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
{
e.Cancel = true; //Cancelling the default back option
MessageBox.Show("You have pressed hardware back button");
}
Namosakr!!!
Comments
- Anonymous
July 25, 2011
Beware! "4.Check the Back button Twice" (www.windowsphonegeek.com/.../5-tips-for-a-successful-wp7-marketplace-submission)