How to Cancel Navigation Programatically in the OnBackKeyPress Event in WP8?

Below is a sample code snippet demonstrating how to cancel Navigation Programatically in the OnBackKeyPress Event in WP8?

How to Cancel Navigation Programatically in the OnBackKeyPress Event in WP8?

protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)

{

if (MessageBox.Show("Stay in Abundantcode.com", "Ask", MessageBoxButton.OKCancel) == MessageBoxResult.Yes)

e.Cancel = false;

base.OnBackKeyPress(e);

}
How to Cancel Navigation Programatically in the OnBackKeyPress Event in WP8?