I'm currently working on a login and registration page within Xamarin Forms and after changing the done button of the keyboard to next and go on the last one I am no longer receiving the Completed event on Android (working fine on iOS). In the custom renderer I can catch the Control.EditorAction event which now acts the same as the Completed event but I can't seem to invoke the Completed event on the entry itself.
Within the EntryRenderer
Control.EditorAction += (object sender, TextView.EditorActionEventArgsargs) =>
{
if (entryExt.ReturnKeyType != ReturnKeyTypes.Next)
entryExt.Unfocus();
// Call all the methods attached to base_entry event handler Completed
entryExt.InvokeCompleted();
};
And within the EntryExt (which extends the Entry directly)
public void InvokeCompleted()
{
Completed?.Invoke(this, null);
}
But the Completed event cannot be invoked due to the error
Error CS0070: The event `Xamarin.Forms.Entry.Completed' can only appear on the left hand side of += or -= when used outside of the type `Xamarin.Forms.Entry'
Is there a way to invoke the Completed event? I'd rather not have a separate event handler for this within my views.
Fixed the issue by changing
entryExt.InvokeCompleted();
inside the EditorAction to
((IEntryController)Element).SendCompleted();
which sends out the completed event back to the Entry base class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With