При добавлении нижнего колонтитула в MvxListView выдается исключение при переходе от действия / фрагмента, когда представление уничтожено:
05-30 11:22:12.164 I/MonoDroid(27621): UNHANDLED EXCEPTION:
05-30 11:22:12.171 I/MonoDroid(27621): System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
05-30 11:22:12.171 I/MonoDroid(27621): at MvvmCross.Platforms.Android.Binding.Views.MvxListView.set_ItemsSource (System.Collections.IEnumerable value) [0x00006] in <dcc1f804568a45a5accd2fb0ee5e5ebf>:0
05-30 11:22:12.171 I/MonoDroid(27621): at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
05-30 11:22:12.171 I/MonoDroid(27621): at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <f32579baafc1404fa37ba3ec1abdc0bd>:0
05-30 11:22:12.171 I/MonoDroid(27621): --- End of inner exception stack trace ---
05-30 11:22:12.171 I/MonoDroid(27621): at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0004b] in <f32579baafc1404fa37ba3ec1abdc0bd>:0
05-30 11:22:12.171 I/MonoDroid(27621): at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <f32579baafc1404fa37ba3ec1abdc0bd>:0
05-30 11:22:12.171 I/MonoDroid(27621): at MvvmCross.Binding.Bindings.Target.MvxPropertyInfoTargetBinding.SetValueImpl (System.Object target, System.Object value) [0x0000c] in <dcc1f804568a45a5accd2fb0ee5e5ebf>:0
05-30 11:22:12.171 I/MonoDroid(27621): at MvvmCross.Binding.Bindings.Target.MvxConvertingTargetBinding.SetValue (System.Object value) [0x00090] in <dcc1f804568a45a5accd2fb0ee5e5ebf>:0
05-30 11:22:12.171 I/MonoDroid(27621): at MvvmCross.Binding.Bindings.Target.MvxPropertyInfoTargetBinding.Dispose (System.Boolean isDisposing) [0x00013] in <dcc1f804568a45a5accd2fb0ee5e5ebf>:0
05-30 11:22:12.171 I/MonoDroid(27621): at MvvmCross.Binding.Bindings.Target.MvxWithEventPropertyInfoTargetBinding.Dispose (System.Boolean isDisposing) [0x0001d] in <dcc1f804568a45a5accd2fb0ee5e5ebf>:0
05-30 11:22:12.171 I/MonoDroid(27621): at MvvmCross.Binding.Bindings.MvxBinding.Dispose () [0x00000] in <dcc1f804568a45a5accd2fb0ee5e5ebf>:0
05-30 11:22:12.171 I/MonoDroid(27621): at MvvmCross.Binding.Bindings.MvxFullBinding.ClearTargetBinding () [0x00039] in <dcc1f804568a45a5accd2fb0ee5e5ebf>:0
05-30 11:22:12.171 I/MonoDroid(27621): at MvvmCross.Binding.Bindings.MvxFullBinding.Dispose (System.Boolean isDisposing) [0x00003] in <dcc1f804568a45a5accd2fb0ee5e5ebf>:0
05-30 11:22:12.171 I/MonoDroid(27621): at MvvmCross.Binding.Bindings.MvxBinding.Dispose () [0x00000] in <dcc1f804568a45a5accd2fb0ee5e5ebf>:0
05-30 11:22:12.171 I/MonoDroid(27621): at MvvmCross.Binding.BindingContext.MvxBindingContext.ClearAllViewBindings () [0x00032] in <dcc1f804568a45a5accd2fb0ee5e5ebf>:0
05-30 11:22:12.171 I/MonoDroid(27621): at MvvmCross.Binding.BindingContext.MvxBindingContext.ClearAllBindings () [0x00000] in <dcc1f804568a45a5accd2fb0ee5e5ebf>:0
05-30 11:22:12.171 I/MonoDroid(27621): at MvvmCross.Droid.Support.V4.EventSource.MvxBindingFragmentAdapter.HandleDestroyViewCalled (System.Object sender, System.EventArgs e) [0x0000f] in <dffbd2c347de4e08a5c9f76935e21411>:0
05-30 11:22:12.171 I/MonoDroid(27621): at MvvmCross.Base.MvxDelegateExtensions.Raise (System.EventHandler eventHandler, System.Object sender) [0x00003] in <dcc1f804568a45a5accd2fb0ee5e5ebf>:0
05-30 11:22:12.171 I/MonoDroid(27621): at MvvmCross.Droid.Support.V4.EventSource.MvxEventSourceFragment.OnDestroyView () [0x00000] in <dffbd2c347de4e08a5c9f76935e21411>:0
05-30 11:22:12.171 I/MonoDroid(27621): at Android.Support.V4.App.Fragment.n_OnDestroyView (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <3682f8af23a748128467fbf9c57ae876>:0
05-30 11:22:12.171 I/MonoDroid(27621): at (wrapper dynamic-method) System.Object.7b7dc7e9-7935-455b-98b9-fc1831f50a54(intptr,intptr)
Представление списка создается с использованием следующего XAML:
<Mvx.MvxListView
android:id="@+id/voucher_list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:MvxItemTemplate="@layout/voucher_list_item"
app:MvxBind="ItemsSource Vouchers" />
И нижний колонтитул добавляется с помощью:
var listView = view.FindViewById<MvxListView>(Resource.Id.voucher_list_view);
var footerView = this.BindingInflate(Resource.Layout.voucher_list_footer, null);
listView.AddFooterView(footerView, null, false);
Это нижний колонтитул XML:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/voucher_list_footer"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:MvxBind="Visibility Visibility(IsLoading)" />
<android.support.v7.widget.AppCompatButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Hent flere bilag"
style="@style/Widget.AppCompat.Button.Borderless"
app:MvxBind="Visibility Visibility(CanLoadMore); Click LoadVouchersCommand" />
</LinearLayout>
При удалении нижнего колонтитула представление уничтожается правильно.Любая идея, что вызывает эту проблему?