There is only one way to close the SIP (Soft Input Panel) by default in Windows Phone 7, and it is by changing focus from the TextBox that is being edited to something else on the screen. As an android user, I am used to close it by hitting the enter key once the text editing is done so I’m gonna show you how to do it and hope it will become a practice.
What we need to do here is change the focus to something other than the TextBox we are currently editing, and for that purpose the PhoneApplicationPage that contains this TextBox will do just fine. All we have to do first is make this page a TabStop so we can enable it to recieve the focus.

<phone:PhoneApplicationPage 
x:Class="PanoramaPivotControls.SettingsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
IsTabStop="True">

...

</phone:PhoneApplicationPage>

Next thing to do is add the KeyUp event handler to the TextBox and implement it.

<TextBox KeyUp="TextBox_KeyUp">

 

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

 

And that’s it! The SIP is now closed when Enter key is typed in!

Hope you find it useful..

2 thoughts on “Hiding the Windows Phone 7 keyboard (SIP) when enter key is typed

Leave a Reply

Your email address will not be published. Required fields are marked *