Skip to content
Sample application demonstrating how to use behaviors to move between fields
C#
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
NextFormFieldSample.Forms
.gitignore
LICENSE
NextFormFieldSample.sln
README.md

README.md

Xamarin Forms: Focus next element sample

Here is a simple Xamarin Forms sample app that demonstrates how you can attach a behavior to an Entry element and move the focus to another element when the user clicks enter on the keyboard.

Using the behavior

Give the element you wish to focus on a name:

<Entry x:Name="Entry2" Placeholder="Field 2"/>

On the element you wish to navigate from, add the behavior and add a reference to the named element.

<Entry Placeholder="Field 1">
    <Entry.Behaviors>
        <behaviors:SetFocusOnEntryCompletedBehavior  TargetElement="{x:Reference Entry2}" />
    </Entry.Behaviors>
</Entry>

When the user presses enter whilst on "Field 1", then focus will moved to "Field 2"

You can’t perform that action at this time.