0

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

public partial class TicketView { Controls.TextInputBox textInputControl;

    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;
    }

}

If anyone have any out of question recommendation for this piece of code, Please tell me.

4

2 に答える 2

1

この行が問題でした理由は正確にはわかりませんが、制御をやり直そうとすると、この行にコメントすると、すべて正常に機能し始めます

this.popup.Margin = newThickness(0,150,0,0);

于 2012-10-15T15:27:37.957 に答える
0

少なくともコードでは、CancelBtnPopUP_Clickどこにもフックしているようには見えません。

それはコード全体ですか?

于 2012-09-19T05:24:35.643 に答える