मैं इस लेआउट: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"
android:layout_height="fill_parent"
android:orientation="vertical"
local:MvxItemTemplate="@layout/accountlistitem"
local:MvxBind="ItemsSource AllAccounts" />
लेआउट इस कोड के साथ टुकड़ा में भरी हुई है:
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);
}
और मेरे ViewModel (संपत्ति बदला गया में इंजेक्ट किया जाता है फोडी के माध्यम से):
public ObservableCollection<Account> AllAccounts
{
get { return accountRepository.Data; }
set { accountRepository.Data = value; }
}
यह काम नहीं करेगा और कोई डेटा नहीं दिखाएगा। लेकिन जब मैं टुकड़ा निम्न पंक्तियां जोड़ें मेरे डेटा ठीक से प्रदर्शित होता है:
var list = view.FindViewById<MvxListView>(Resource.Id.accountList);
list.ItemsSource = ViewModel.AllAccounts;
एक अन्य उदाहरण में यह स्थिर संस्करण पर किसी भी समस्याओं के बिना काम किया। बाध्यकारी भी एक गतिविधि में काम करता प्रतीत होता है, लेकिन एक टुकड़े में नहीं। इस परियोजना के लिए मैं v4.0.0 बीटा 2 का उपयोग करता हूं। क्या मुझे कुछ याद आती है? GitHub भंडार को
लिंक: https://github.com/NPadrutt/MoneyManager
धन्यवाद
इससे जुड़ा समस्या: https://github.com/MvvmCross/MvvmCross/issues/1120 – Martijn00
मुझे एक ही समस्या थी। मेरी परियोजना AppCompat सुविधाओं का उपयोग करता है। मुझे वीरियस में काम करने से पहले Cirrious.MvvmCross.Droid.Support.AppCompat जोड़ना था। बी 4 बीटा में काम करेगा। सुनिश्चित नहीं है कि यह आपके लिए काम करेगा, बस उल्लेख करें कि यह मेरे लिए काम करता है। – GrantVS
दुर्भाग्यवश यह कुछ भी नहीं बदलता है .. interessting बात यह है कि यह केवल टुकड़े में होता है। एक सामान्य गतिविधि का बंधन ठीक काम करता है। – NPadrutt