我在我的ViewModel中有自定義對象。MVVMCross數據綁定不起作用
public MyObject PropertyName
{
get { return _propertyName; }
set
{
_propertyName = value;
RaisePropertyChanged(() => PropertyName);
}
}
我想在我的機器人視圖中僅將其一個成員綁定到textview。找到這個鏈接: Bind data of custom object to TextView in MvvmCross 而我正是這樣做。本地:MvxBind =「TEXT Myobject.ItsMember」
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="LabelCaption" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:textColor="@android:color/white"
local:MvxBind="Text Myobject.ItsMember" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
經過套管等,但結合不工作,我無法看到屏幕上顯示的字符串值,而我可以在調試窗口打印。 任何可能會出錯的線索?
你在哪裏誇大這個觀點? – Cheesebaron
[活性(標籤= 「MyView的」)] 公共類MyView的:MvxActivity { 保護覆蓋無效OnViewModelSet() \t \t { 的setContentView(Resource.Layout.MyView); \t \t} } – Vivek
而'Myobject'是你的ViewModel中屬性的名稱? – Cheesebaron