Android MvvmCross片段绑定不';行不通
我有这样的布局:Android MvvmCross片段绑定不';行不通,android,xamarin,mvvmcross,Android,Xamarin,Mvvmcross,我有这样的布局: <cirrious.mvvmcross.binding.droid.views.MvxListView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:local="http://schemas.android.com/apk/res-auto" android:id="@+id/accountList" android:layout_width="fill_parent"
<cirrious.mvvmcross.binding.droid.views.MvxListView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:id="@+id/accountList"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
local:MvxItemTemplate="@layout/accountlistitem"
local:MvxBind="ItemsSource AllAccounts" />
在我的ViewModel中(更改的属性通过fody注入):
公共可观测集合
谢谢我从当前的开发分支构建了自己的dll。这里的问题已经解决了。因此,解决方案似乎就是等待beta3:)问题与此相关:我也有同样的问题。我的项目使用AppCompat功能。我必须先添加cirries.MvvmCross.Droid.Support.AppCompat,然后才能在v4 beta 2中进行绑定。我不确定这是否对你有效,只是提到它对我有效。不幸的是,这并没有改变任何事情。。有趣的是,它只出现在片段中。正常活动的绑定工作正常。
public new AccountListViewModel ViewModel
{
get { return (AccountListViewModel)base.ViewModel; }
set { base.ViewModel = value; }
}
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
var ignore = base.OnCreateView(inflater, container, savedInstanceState);
return this.BindingInflate(Resource.Layout.AccountListLayout, null);
}
public ObservableCollection<Account> AllAccounts
{
get { return accountRepository.Data; }
set { accountRepository.Data = value; }
}
var list = view.FindViewById<MvxListView>(Resource.Id.accountList);
list.ItemsSource = ViewModel.AllAccounts;