Question

How can I programmatically display the soft input panel (SIP)/keypad, via code. (I dont have a text-box on which I can specify the InputScope).

Was it helpful?

Solution

From Jeff Blankenburgs 31 Days of Windows Phone 7:

Sometimes, you want to get keyboard input from your user, even when you don’t want to present them with an actual TextBox. There’s probably plenty of ways around this, but I’ve been using a handy one that is simple to accomplish. (If you’re searching for a reason to do this, think of a game of Hangman. I don’t want the keyboard visible always, but I also don’t want a TextBox on the screen.)

Put a button on your page.

Put a TextBox on your page, but make sure it’s hidden from the user’s view.

Either position it off screen, make it completely transparent (and in the absolute background), or some other method that allows it to get added to your visual tree, but doesn’t let the user see it.

Set an event handler on your button that sets Focus() to the hidden textbox when it’s clicked.

That’s it! This will allow you to show the keyboard without the user seeing a textbox.seeing a textbox.

OTHER TIPS

If you're using XNA, you can use Guide.BeginShowKeyboardInput but i'm not sure that that is allowed if you're doing silverlight. But i will second the comment on "why?" because if you don't have a textbox, how are you showing the user what they are typing?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top