windows phone 首页中的按返回键提示退出对话框

 

 

 

<phone:PhoneApplicationPage 
    ........
    BackKeyPress="PhoneApplicationPage_BackKeyPress"
    ........
>

 

 

        private void PhoneApplicationPage_BackKeyPress(object sender, System.ComponentModel.CancelEventArgs e)
        {
            e.Cancel = true;
            if (MessageBox.Show("是否退出""提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                new Microsoft.Xna.Framework.Game().Exit(); 
            }
        }

 

posted @ 2012-06-03 21:29  therockthe  阅读(138)  评论(0)    收藏  举报