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");