简体   繁体   中英

Textbox issue in windows phone 7?

In my app,I just have a page with four text boxes, so when i click a text box soft keyboard appears, now when i want to move to next textbox then i have to tap outside the textbox to make the keyboard disappear and then click on another text box. I don't think it is user friendly, so i have two options, 1)To change the functionality of return button(to make it work as tab). 2)To reduce the frame size and so scrolling will be enabled.

How can I do the foretold two options in windows phone 7??

for the first option Make return key of the input panel work like tab key.

make key down event of 1st textbox like this

private void txt1_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
        {
            if (e.Key == System.Windows.Input.Key.Enter)
            {
               txt2.Focus();
            }
        }

similarly make this event for txt2 and txt3 and give focus accordingly and on on txt4 keydown event focus the main grid.

and about the 2nd way. Its a big problem in wp according to my knowledge.

For moving to next textbox @Amu 's answer will work perfect, and to dismiss the keyboard,

if (e.Key == System.Windows.Input.Key.Enter)
  {
    this.Focus();
  }

That will take the focus away from your text box and will bring it to your screen. And So keyboard will disappear!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM