Windows Phone 7 - Hide Software Keyboard Programmatically

2 October 2010

When a user clicks into a TextBox in WP7, the software keyboard automatically slides up from the bottom of the screen (if you don't have a hardware keyboard, at least). Once the TextBox loses focus (such as when the user clicks on the page itself), the keyboard slides out of view. Therefore, if you want to hide the keyboard in response to, say, the enter key being pressed on the keyboard, you just need to map an event handler to the KeyUp event, check if the Event's KeyPressed is Key.Enter, and if it is, set the PhoneApplicationPage to have focus. Pretty simple!

Thanks to this blog post for the tip.

Tags: keyboard, programming, silverlight, wp7

Add a Comment

No Comments