Skip to content

Instantly share code, notes, and snippets.

@JoeM-RP
Created June 25, 2018 02:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoeM-RP/21263e7b82160beab99cf942de0a66ee to your computer and use it in GitHub Desktop.
Save JoeM-RP/21263e7b82160beab99cf942de0a66ee to your computer and use it in GitHub Desktop.
using System;
using samples.core.Controls;
using samples.Droid.Effects;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
[assembly: ExportEffect(typeof(EntryMoveNextEffect), nameof(EntryMoveNextEffect))]
namespace samples.Droid.Effects
{
public class EntryMoveNextEffect : PlatformEffect
{
protected override void OnAttached()
{
// Check if the attached element is of the expected type and has the NextEntry
// property set. if so, configure the keyboard to indicate there is another entry
// in the form and the dismiss action to focus on the next entry
if (base.Element is EntryMoveNextControl xfControl && xfControl.NextEntry != null)
{
var entry = (Android.Widget.EditText)Control;
entry.ImeOptions = Android.Views.InputMethods.ImeAction.Next;
entry.EditorAction += (sender, args) =>
{
xfControl.OnNext();
};
}
}
protected override void OnDetached()
{
// Intentionally empty
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment