更新时间:2023-02-08 18:52:58
根据认证要求,不建议覆盖后退按钮 -
As per certification requirements it is not recommended to override the back button -
从应用程序的第一个屏幕按下返回按钮必须关闭应用程序.
Pressing the Back button from the first screen of an app must close the app.
http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh184840%28v=vs.105%29.aspx
你可以试试这个代码
protected override void OnBackKeyPress(CancelEventArgs e)
{
if(MessageBox.Show("Are you sure you want to exit?","Confirm Exit?",
MessageBoxButton.OKCancel) != MessageBoxResult.OK)
{
e.Cancel = true;
}
}