Xamarin Forms Entry调用Completed事件

Meg*_*ley 7 c# android xamarin xamarin.forms

我目前正在Xamarin Forms中的登录和注册页面上工作,在将键盘的完成按钮更改为下一个并继续上一个后,我不再在Android上接收完成事件(在iOS上正常工作).在自定义渲染器中,我可以捕获Control.EditorAction事件,该事件现在与Completed事件的行为相同,但我似乎无法在条目本身上调用Completed事件.

在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();
};
Run Code Online (Sandbox Code Playgroud)

在EntryExt中(直接扩展Entry)

public void InvokeCompleted()
{
    Completed?.Invoke(this, null);
}
Run Code Online (Sandbox Code Playgroud)

但由于错误,无法调用Completed事件

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'
Run Code Online (Sandbox Code Playgroud)

有没有办法调用Completed事件?我宁愿在我的视图中没有单独的事件处理程序.

Meg*_*ley 9

通过更改修复了问题

entryExt.InvokeCompleted(); 
Run Code Online (Sandbox Code Playgroud)

在EditorAction里面

((IEntryController)Element).SendCompleted(); 
Run Code Online (Sandbox Code Playgroud)

它将完成的事件发送回Entry基类.