當用戶點擊後退按鈕後點擊「取消」按鈕時,如何阻止我的應用程序返回?WP7停止頁面導航/返回
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
}
}
在這樣小心,因爲這取決於使用,有可能倒塌的認證要求的犯規;特別是[第5.2.4節](http://msdn.microsoft.com/en-us/library/hh184840%28v=vs.92%29.aspx) –