C# MvvmCross-MvxBind:警告无法为绑定Hello for-empty创建目标绑定-
我刚刚启动了我的第一个Xamarin应用程序,并已将其设置为一个新解决方案的默认配置,只需很少的更改 应用程序可以很好地编译并部署到虚拟设备 MvxBindingAttributes.xmlC# MvvmCross-MvxBind:警告无法为绑定Hello for-empty创建目标绑定-,c#,android,xamarin,xamarin.android,mvvmcross,C#,Android,Xamarin,Xamarin.android,Mvvmcross,我刚刚启动了我的第一个Xamarin应用程序,并已将其设置为一个新解决方案的默认配置,只需很少的更改 应用程序可以很好地编译并部署到虚拟设备 MvxBindingAttributes.xml <?xml version="1.0" encoding="utf-8"?> <resources> <declare-styleable name="MvxBinding"> <attr name="MvxBind" format="string"/&
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="MvxBinding">
<attr name="MvxBind" format="string"/>
<attr name="MvxLang" format="string"/>
</declare-styleable>
<declare-styleable name="MvxControl">
<attr name="MvxTemplate" format="string"/>
</declare-styleable>
<declare-styleable name="MvxListView">
<attr name="MvxItemTemplate" format="string"/>
<attr name="MvxDropDownItemTemplate" format="string"/>
</declare-styleable>
<item type="id" name="MvxBindingTagUnique"/>
<declare-styleable name="MvxImageView">
<attr name="MvxSource" format="string"/>
</declare-styleable>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="40dp"
local:MvxBind="Text Hello" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="40dp"
local:MvxBind="Hello" />
</LinearLayout>
<TextView
...
local:MvxBind="Hello" />
如果我关闭虚拟设备上的应用程序,然后再次启动它,我会得到:
MvxBind:Warning: 97.69 Failed to create target binding for binding Hello for -empty-
[0:] MvxBind:Warning: 97.69 Failed to create target binding for binding Hello for -empty-
05-13 12:58:06.802 I/mono-stdout( 683): MvxBind:Warning: 97.69 Failed to create target binding for binding Hello for -empty-
我似乎找不到比去年更近的关于这个问题的任何东西
为什么它报告绑定失败,但仍按预期绑定?另外,为什么警告号(8.57/9.69)会改变,但有相同的错误信息
解决方案中还包含了默认的
LinkerPleaseInclude.cs
文件,因此我现在对此感到有点困惑。您需要设置要在活动中使用的viewmodel
更改此行:
公共类HomeView:MVX活动
致:
公共类HomeView:MVX活动
我的一个绑定声明不正确:
HomeView.axml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="MvxBinding">
<attr name="MvxBind" format="string"/>
<attr name="MvxLang" format="string"/>
</declare-styleable>
<declare-styleable name="MvxControl">
<attr name="MvxTemplate" format="string"/>
</declare-styleable>
<declare-styleable name="MvxListView">
<attr name="MvxItemTemplate" format="string"/>
<attr name="MvxDropDownItemTemplate" format="string"/>
</declare-styleable>
<item type="id" name="MvxBindingTagUnique"/>
<declare-styleable name="MvxImageView">
<attr name="MvxSource" format="string"/>
</declare-styleable>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="40dp"
local:MvxBind="Text Hello" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="40dp"
local:MvxBind="Hello" />
</LinearLayout>
<TextView
...
local:MvxBind="Hello" />
应该是:
<TextView
...
local:MvxBind="Text Hello" />
缺少类型Text
<TextView
...
local:MvxBind="Text Hello" />