The following forum(s) have migrated to Microsoft Q&A (Preview): Developing Universal Windows apps!
Visit Microsoft Q&A (Preview) to post new questions.

Learn More

 locked
How to customize the on-screen keyboard? RRS feed

  • Question

  • I have a bunch of TextBox controls on the screen.  As it stands now, the user would have to click on textbox, wait for the keyboard to come up, enter something, then tap on an empty space on the page, so that the keyboard disappears (because the keyboard is covering up other textboxes) , then do the same thing for the next textbox and so on.

    1. What is the accepted way to handle this situation?
    2. Is there a way to customize the keyboard to have the Next button (like on the iPhone), that would take the user to the next textbox in the tab order.

    Thanks.
    Friday, November 26, 2010 1:44 AM

All replies

  • There is no way to customize the keyboard.  Pressing the back button on the phone will also close the keyboard so they can select the next textbox.

    You can always add a button next to each textbox that will set focus on the next textbox on your page.  The page should scroll so the keyboard doesn't cover up the textbox.
    Friday, November 26, 2010 5:03 AM
  • My suggestion is that when a TextBox gets focus, activate an application bar that has a "check" icon button. When clicked, have it set focus to the next TextBox. So effectively this button is like adding an extra key to the keyboard.

    Richard
    Friday, November 26, 2010 8:46 AM
  • I just came across this blog entry from Microsoft: Make sure your buttons are visible, even when the keyboard is displayed.
    Saturday, November 27, 2010 1:11 AM
  • I was wondering about this topic myself so I checked around in the native apps and the accepted practice appears to be using the Enter key on the virtual keyboard as a Tab or "Next" key. I couldn't find a way to enable this behavior in the Silverlight TextBox control (the TabIndex, IsTabStop, and TabNavigation properties don't seem to do anything) so I hacked it in by handling the KeyDown event on every single TextBox control and redirecting the focus to the next TextBox manually.


    private void textBox1_KeyDown(object sender, KeyEventArgs e)
    {
        if (e.Key == Key.Enter)
        {
            textBox2.Focus();
        }
    }


    This gives the behavior I was looking for, but I have to maintain an event handler for every textbox on the page and if their orders change in the UI I have to manually tweak the code to maintain the expected tab order. Has anybody figured out a more elegant solution to this problem?
    Friday, January 7, 2011 5:49 PM
  • chefgon,

    There are some nuances -- for instance you can have just one event handler and have all your textboxes send to it -- but yours is the standard solution.  And there isn't currently any support for tabbing, tho perhaps someone would like to write it since we all need it.

    Something to keep in mind if you are using MVVM -- binding only occurs when you lose focus on a textbox, so a best practice is to handle the keydown event, check to see if the Enter key is pressed, and then set focus to the page itself (or some random element) in order to ensure that the VM is updated.

    James

    Friday, January 7, 2011 8:03 PM