Skip to content

adenearnshaw/xam-focus-next-element

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

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"

About

Sample application demonstrating how to use behaviors to move between fields

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages