One problem I have encountered on various WP7 apps (including my own applications) is moving between text boxes on a page. The problem can present itself when the SIP is being displayed in front of the next control that requires input.
In some cases the user is forced to press an area on the page that does not include a text control to take the focus away from the text box. Once the SIP is hidden then the user can click the control they want to enter text into.
This is mainly because the controls do not support the concept of tab order because the SIP does not include a tab control to move between controls.
One solution to this is to look for the enter key to be released and move the focus on to the next control:
private void txtUsername_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
if (e.Key == System.Windows.Input.Key.Enter)
This could prove to be a pain for developers and forces additional code within the page code file that can be said to be quite untidy.
It is because of this that I have created my own solution using a behaviour that can be attached to a control. One advantage of this is that it will be possible to set the values using Blend therefore reducing the reliance on the developer.
The OnEnter Behaviour:
The XAML below gives an example on how the behaviour can be attached to a text box
<mh:OnEnter NextControlName="txtPassword" />
The additional namespaces that I have added to the page are:
You can download the project from here. (if you have any problems downloading this then please send me an email at: mike [at] mikehole [dot] com and I will send it on).
If you can think of any ways that the behaviour can be improved or know of any better solutions then feel free to leave a comment.
[…] WP7 Text Boxes – OnEnter (my 1st Behaviour). (Mike Hole) […]
Looks like we have the same taste when it comes to wordpress styles 🙂
Yeah us and Jessy Liberty! mind you can’t find a good code snippet add on for live writer 😦
Please have a look at my keyboard behaviour over at http://pauliom.wordpress.com as it also talks about tab stops. Also how to use it with binding too. Sorry using wp7 so can’t copy and paste actual link
[…] Mike Hole’s Blog In some cases the user is forced to press an area on the page that does not include a text control […]
The link is no longer available 😦
Any chance i can get it?
After some reckless housekeeping of my SkyDrive I managed to delete the source code.
All is not lost however as Derek Lakin has created a similar project that can be found here: http://blog.dereklakin.com/user-friendly-input-pages/