android - Mvvmcross Bind Click 仅在获得焦点后触发

标签 android xamarin mvvmcross

    <CC.CustomEditText
        android:id="@+id/receptionIdentityArticle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:theme="@style/ExtendProTheme"
        android:maxLength="20"
        style="@style/ExtendProTheme.EditText"
        android:layout_below="@+id/suppliersSearchInputLabel"
        local:MvxBind=" Text ArticleSearchClause, Mode=TwoWay; EnterCommand SearchArticlesCommand; Error Errors['ArticleSearchClause']; Click OnSearchClickCommand" />

所以我有一个不同于 EditText 的 CustomEdit,它覆盖了两个事件

    this.KeyPress += OnEnterKeyPressed;
    this.FocusChange += OnFocusChange;

我的问题是 Click 命令仅在我第二次单击 EditText 时触发。第一次它只是聚焦然后我第二次单击它触发 Click 命令。我想它应该是这样工作的,但我想捕获它在 EditText 上完成的第一次点击。可能触发了另一个事件,但我找不到包含 EditText 上所有可能绑定(bind)的文档。有什么想法可以捕捉到对 EditText 的第一次点击吗?

最佳答案

您可以使用 Touch 事件而不是 Click 来让事件在第一次点击时触发。不幸的是,您描述的行为对于 Android 来说是正常的(尽管令人困惑)并且与 MVVMCross 无关。

关于android - Mvvmcross Bind Click 仅在获得焦点后触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42650150/

相关文章:

c# - 在 MvvmCross 中将单个 View/ViewModel/Xaml 链接到多个 Json 资源文件的最佳方式

android - 我可以使用 Phonegap Build 在 Phonegap 中播放视频吗

java - android中字符串的 Camel 大小写验证

c# - 使用 MonoMac 以编程方式在窗口内的 WebView 中显示网页

Android 图像裁剪 Uri 异常

xamarin.ios - mvvmcross TabBarController ViewModel Init() 未调用?

Android Studio : Error inflating class android. support.design.widget.FloatingActionButton

android - 使用 adb shell 发送 AT 命令

android - Xamarin.Forms 中心标题和透明导航栏 - Android

c# - 如何从命令对象中访问整个 ViewModel