在启用链接器的情况下,将MvvmCross从4.2.3更新到4.4.0后,Android EditText绑定被破坏

Ale*_*akh 5 android xamarin.android android-edittext mvvmcross xamarin

之前正在运行的我的MvvmCross Android应用程序因为从4.2.3到4.4.0的MvvmCross更新而被打破

<EditText
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   local:MvxBind="Text Login" />

public string Login
{
    get { return _login; }
    set { SetProperty(ref _login, value); }
}
Run Code Online (Sandbox Code Playgroud)

LinkerPleaseInclude当然:

public void Include(EditText text)
        {
            text.Enabled = !text.Enabled;
            text.TextChanged += (sender, args) => text.Text = "" + text.Text;
            text.Hint = "" + text.Hint;
            text.Click += (s, e) => text.Visibility = text.Visibility - 1;
        }

        public void Include(TextView text)
        {
            text.TextChanged += (sender, args) => text.Text = "" + text.Text;
            text.Hint = "" + text.Hint;
            text.Click += (s, e) => text.Text = text.Text + "";
        }
Run Code Online (Sandbox Code Playgroud)

链接器"仅SDK"已启用.对于禁用的链接器,它工作正常 其他绑定也可以正常工作(按钮点击,可见性等).

如何告诉链接器正确处理?这可能有什么问题?

Che*_*ron 15

绑定目标EditTextTextView使用该AfterTextChanged事件,该事件可能会被链接起来.将其添加到您的Include方法而不是TextChanged它应该工作:

public void Include(TextView text)
{
    text.AfterTextChanged += (sender, args) => text.Text = "" + text.Text;
    text.Hint = "" + text.Hint;
    text.Click += (s, e) => text.Text = text.Text + "";
}
Run Code Online (Sandbox Code Playgroud)

我不认为你需要一个单独的方法EditText作为EditText继承TextView.