title: MessageBox in Windows Phone 8.1
body: <p>I want to show a MessageBox to the user when the back button has been pressed on the hardware, but it's simply doesn't work. I tried these variations, but I never see the MessageBox:</p>
  
  <pre><code>    // VARIATION 1
      IAsyncResult mbResult = Microsoft.Xna.Framework.GamerServices.Guide.BeginShowMessageBox("Warning", "Are you sure you want to leave this page?",
      new string[] { "Yes", "No" }, 0, Microsoft.Xna.Framework.GamerServices.MessageBoxIcon.None, null, null);
  
      mbResult.AsyncWaitHandle.WaitOne();
  
      int? yesNo = Microsoft.Xna.Framework.GamerServices.Guide.EndShowMessageBox(mbResult);
      if (yesNo.HasValue)
      {
          if (yesNo.Value == 0)
          {
              // Yes pressed
          }
          else
          {
              // No pressed
          }
      }
  
      // VARIATION 2
      MessageBoxResult mbr = MessageBox.Show("Are you sure you want to leave this page?", "Warning", MessageBoxButton.OKCancel);
  
      if(mbr == MessageBoxResult.OK)
      {
          // OK pressed
      }
      else
      {
          // Cancel pressed
      }
  </code></pre>
  
  <p>If I write <code>e.Cancel = true</code> to the <code>OnBackKeyPress</code> event then I can't leave the page, so the code is executing, but I never see the MessageBox:</p>
  
  <pre><code>protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
  {
      e.Cancel = true;
  }
  </code></pre>
  
  <p>What can be the problem, or what I'm doing wrong?</p>