bool isExit = false;

        // 构造函数
        public MainPage()
        {
            InitializeComponent();
            isExit = false;
            // 用于本地化 ApplicationBar 的示例代码
            //BuildLocalizedApplicationBar();
        }

        protected override void OnBackKeyPress(CancelEventArgs e)
        {
            if (!isExit)
            {
                isExit = true;
                var toast = new ToastPrompt {Message = "再按一次退出程序"};
                toast.Completed += (o, ex) => { isExit = false; };
                toast.Show();
                e.Cancel = true;
            }
            else
            {
                NavigationService.RemoveBackEntry();
            }
        }

需要引用Coding4Fun.Toolkit.Controls:https://coding4fun.codeplex.com/

相关文章:

  • 2022-12-23
  • 2021-12-10
  • 2022-12-23
  • 2021-11-03
  • 2022-12-23
  • 2022-01-17
  • 2022-12-23
  • 2022-02-28
猜你喜欢
  • 2021-11-06
  • 2021-12-20
  • 2022-12-23
  • 2021-05-30
  • 2021-07-20
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案