当用户在点击后退按钮后点击“取消”按钮时,如何阻止我的应用程序返回?
protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
{
var buttonInfo = MessageBox.Show("Are you sure you want to exit?", "Exit", MessageBoxButton.OKCancel);
if (buttonInfo == MessageBoxResult.OK)
{
this.NavigationService.GoBack();
}
else
{
//How to stop page from navigating
}
}