【发布时间】:2014-02-20 04:58:04
【问题描述】:
是否可以嵌套绑定 MvxListView(mvvmcross android v3.1 系列)?
我发现嵌套绑定失败:
MvxBind:Warning: 1.17 Unable to bind: source property source not found Property:Command on MenuSection
我们的 ViewModel 有点像
class SomeViewModel : MvxViewModel{
public List<MenuSection> Sections{get;set;}
}
在哪里
class MenuSection{
public string Title{get;set;}
public MenuItem[] Items{get;set;}
}
class MenuItem{
public string Name {get;set;}
public ICommand Command{get;set;}
}
删除了大多数非 mvx 属性的 axml 的缩减版本如下所示:
layout/page_home.axml
<android.support.v4.widget.DrawerLayout>
<FrameLayout android:id="@+id/content_frame"/>
<Mvx.MvxListView
local:MvxBind="ItemsSource Sections"
local:MvxItemTemplate="@layout/item_menusection" />
</android.support.v4.widget.DrawerLayout>
layout/item_menusection.axml
<LinearLayout>
<TextView local:MvxBind="Text Title"/>
<Mvx.MvxListView
local:MvxItemTemplate="@layout/item_menusection_item"
local:MvxBind="ItemSource Items; ItemClick Command" />
</LinearLayout>
布局/item_menusection_item.axml
<TextView local:MvxBind="Text Name"/>
【问题讨论】:
标签: mvvmcross