webdad3
webdad3

Reputation: 9080

Using the Enter Key to move between Textboxes

A user of one of my apps said that he was "expecting" the Enter key to move between the Textboxes. Is there a way to do that with the Windows Phone?

See you can set the TabIndex of each control but do I have to write a lot of code to capture the onKeyDown?

Just wondering if there is an easy way to add this feature.

Upvotes: 1

Views: 87

Answers (1)

har07
har07

Reputation: 89285

One decent options is, by implementing logic to move between Textboxes as Custom Behavior. Like done by Mike Hole as written in his blog. With Mike's custom behavior, we can simply attach that behavior to the textbox and specify control name to move focus to upon enter key pressed :

<TextBox x:Name="txtUsername">
    <i:Interaction.Behaviors>
        <mh:OnEnter NextControlName="txtPassword" />
    </i:Interaction.Behaviors>
</TextBox>

Upvotes: 2

Related Questions