I have overridden this method:
protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
{
base.OnBackKeyPress(e);
IAsyncResult guide = Guide.BeginShowMessageBox(
"Alert", "Do you want to go to the Menu Page?",
new string[] { "YES", "NO" }, 0,
MessageBoxIcon.Alert, null, null);
int result = (int)Guide.EndShowMessageBox(guide);
if (result == 0) // YES
{
NavigationService.Navigate(new Uri("/MenuPage.xaml", UriKind.RelativeOrAbsolute));
}
else // NO
{
}
}
Now when I press “no” it still brings me back to the previous page, I just want to override this feature by making it stay on the current page only, without restarting the page. Can I?
You can ‘cancel’ the event as follows: