Thursday, March 6, 2014

Getting out of the SIP (Soft Input Panel) programmatically

I have been cranking on my first phone application and working with some basic user requirements.
I did not get to far in before I ran into this issue.  Most of the how apps just blow by the simple issue
of going from one text element to the next.  I just assumed it was like working with a web form.  Well forgot I am not working with a the benefit of a browser which defines a lot of this default behavior. 

The text box control will display the SIP as soon as you focus on it.  The issue is when you want to leave the textbox.  The return key and tab key will not kick you back out to the page level.  You need to handle the event Keyup or LostFocus.


XAML

<TextBox Name="Input" KeyUp="Input_KeyUp" LostFocus="Input_KeyUp"  FontSize="40"></TextBox>
 
C# Code Behind

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


The call to the main page will return the focus from the current textbox back to the phoneapplicationpage. 


Source:
http://blogs.msdn.com/b/silverlight_sdk/archive/2010/07/02/programmatically-dismiss-the-sip-keyboard-in-windows-phone-silverlight-app.aspx

No comments:

Post a Comment