locked
Textbox tab index not work sometimes RRS feed

  • Question

  • Hello,

    I have two buttons which navigate to the same page,

    one button is on the appbar, the other one is on a Popup,

    1,click the buttton on the appbar, navigate to the destination page, and the cursor show in the TextBox,

    2,click the button on the Popup, navigate to the same destination page,  but the cursor not show in the TextBox.

    I checked, the only difference is where the button locates.

    I hope the cursor will shown in the TextBox whenever the page is from.

    Can anyone help me?

    Thanks.


    programmer

    Saturday, April 27, 2013 7:32 AM

Answers

  • Try to set the focus of textbox on loaded event of its parent control

    like this-

    private void grdSearchDetails_Loaded(object sender, RoutedEventArgs e)
    {
           txtSearchText.Focus(Windows.UI.Xaml.FocusState.Keyboard);
    }

    • Proposed as answer by RishiRajIT Monday, April 29, 2013 12:32 PM
    • Marked as answer by Aaron Xue Wednesday, May 8, 2013 10:07 AM
    Monday, April 29, 2013 12:32 PM