wp7 Keyboard helper as a behavior

Thanks to a number of comments regarding the problems I had with the ApplicationBar and the keyboard I’ve decided to apply some of the ideas to my previous post (thanks everyone for the comments) about a keyboard helper to create a self contained keyboard tab helper behavior (mouthful). I’ve posted the full code and binaries, Wp7KeyboardSource.zip
but essentially all you now have to do is;

<Grid x:Name=ContentGrid Grid.Row=1>

  <i:Interaction.Behaviors>

    <keyboard:KeyboardTabHelperBehavior />

  </i:Interaction.Behaviors>

  <StackPanel Orientation=Vertical>

    <CheckBox IsTabStop=True TabIndex=4 Content=Some check/>

    <TextBox TabIndex=1 Text=start here/>

    <TextBox IsTabStop=True Text=Won’t tab here cause not set tabindex/>

    <TextBox IsEnabled=False TabIndex=2 Text=not here cause disabled/>

    <TextBox TabIndex=3 Text=next stop here/>

  </StackPanel>

</Grid>

 …and that’s it, no code behind, no adding of event handlers. Just set up your tab index and stops and it will take care of the rest.

4 thoughts on “wp7 Keyboard helper as a behavior

  1. pauliom September 8, 2010 / 12:56 pm

    Oooops, noticed that I’ve posted the version without the code to unattach the key event when the behavior is unattached, please make sure you add that if you’ve already taken it.

  2. Jay Kannan December 7, 2011 / 3:27 pm

    Is there a way to extend this to work with ItemContainer and Itemtemplates with TextBoxes in them?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s