Windows Phone Back KeyPress + MessageBox crashes the app without Selection

前端 未结 3 875
攒了一身酷
攒了一身酷 2021-01-15 06:19

I have a strange issue overriding BackkeyPress Function in code behind, inside the function i have a simple message box to Go back or cancel navigation ( stay in current pag

3条回答
  •  攒了一身酷
    2021-01-15 06:51

    I found one more solution to this, so I thought it would be good if I posted it here. It's just a workaround though.

    private async void PhoneApplicationPage_BackKeyPress (object sender, System.ComponentModel.CancelEventArgs e)
    {
         e.Cancel = true;
         await Task.Delay(100);
         if (MessageBox.Show(msg, cap, MessageBoxButton.OKCancel) == MssageBoxResult.OK)
         {
              //somecode
         }                
    }
    

    Source

提交回复
热议问题