【发布时间】:2017-02-23 04:14:20
【问题描述】:
所以我有一个 MvxListView
<Mvx.MvxListView
android:id="@+id/receptionsListView"
android:divider="@drawable/divider"
android:scrollbars="vertical"
android:choiceMode="singleChoice"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="left|start"
local:MvxItemTemplate="@layout/item_supplier"
local:MvxBind="ItemsSource ReceptionSuppliersList; ItemClick SelectReceptionCommand;" />
我想根据列表中模型的值启用/禁用一些项目。像
local:MvxBind="ItemsSource ReceptionSuppliersList; ItemClick SelectReceptionCommand; Enabled ReceptionSuppliersList.IsValid" />
根据我的测试,这只是禁用了我的所有列表项,因为没有这样的属性 ReceptionSuppliersList.IsValid (它是 ReceptionSuppliersList[i].IsValid )。我怎样才能做到这一点。
我也尝试像这样在 item_supplier 上添加 Enabled 属性
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="0dp"
style="@style/ExtendProTheme.ReceptionItem"
local:MvxBind="Enabled IsValid" >
但还是不行。
任何想法如何根据属性禁用列表中的某些项目?
PS: 我的物品看起来像这样
public string Username { get; set; }
public string DeviceId { get; set; }
public bool IsValid { get; set; }
【问题讨论】:
-
你的输出中有什么东西吗?可能有些绑定错误?
-
我的绑定没有看到任何错误。
-
您是否尝试过在项目模板的根目录上绑定
Enabled而不是MvxListView?
标签: xamarin mvvmcross mvxlistview