title: Trouble with POPUP and Events in Windows Phone 7.1
body: <p>I have a button that activate a service but before that service is activate i need to force the user to enter a text, for that task i create a user control that allow the user to enter text and validate it, on that control i have 2 buttons OK and cancel, OK button is working fine but the cancel is supposed to hide the popup, but the event don't get triggered, i need to hit the button several times before that happen, i am also getting a similar problem if the person hits back i cant get rid of the popup without closing the app. What is the best approach to work with popup and in this case why is the event is not getting trigger on the first hit</p>
  
  <p>public partial class TicketView
  {
         Controls.TextInputBox textInputControl;</p>
  
  <pre><code>    private void InitCloseTxtInput()
      {
          textInputControl = new Controls.TextInputBox(8, 0);
          textInputControl.CancelBtn.Click += new RoutedEventHandler(CancelBtn_Click);
          textInputControlForCamara.CancelBtn.Click += new RoutedEventHandler(CancelBtn_Click);
      }
      private void AppBarBtn_Click(object sender, EventArgs e)
      {
          InitCloseTxtInput();
          PivotContainer.IsEnabled = false;
          this.popup = new Popup();
          this.popup.Margin = new Thickness(0, 150, 0, 0);
          this.popup.Child = textInputControl;
          this.popup.IsOpen = true;
      }
      void OkBtnOnPopUP_Click(object sender, RoutedEventArgs e)
      {
         //Call Service
      }
      void CancelBtn_Click(object sender, RoutedEventArgs e)
      {
          this.popup.IsOpen = false;
          this.PivotContainer.IsEnabled = true;
      }
  </code></pre>
  
  <p>}</p>
  
  <p>If anyone have any out of question recommendation for this piece of code, Please tell me.</p>