2

私は非常に単純な状況でMvxImageViewLoaderを使用します。

ViewDidLoad:

        var pnlBackImage = new UIImageView(new RectangleF(0, 0, pnlBack.Frame.Width, pnlBack.Frame.Height));
        Add(pnlBackImage);
        pnlBackImageLoader = new MvxImageViewLoader(() => pnlBackImage);

        ...

        set.Bind(pnlBackImageLoader).To(x => x.UserBackgroundUrl);

ここで、UserBackgroundUrl は共通の文字列プロパティです。

しかし、set.Apply()では、ログに次のように表示され、画像が読み込まれていません:

2013-06-24 13:51:26.999 SPBTouch[446:21b03] MvxBind: Error:   2.78 Problem seen during binding execution for from UserBackgroundUrl to ImageUrl - problem TargetInvocationException: Exception has been thrown by the target of an invocation.
      at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000d9] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:236 
  at System.Reflection.MonoProperty.SetValue (System.Object obj, System.Object value, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] index, System.Globalization.CultureInfo culture) [0x00064] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/MonoProperty.cs:353 
  at System.Reflection.PropertyInfo.SetValue (System.Object obj, System.Object value, System.Object[] index) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/PropertyInfo.cs:93 
  at Cirrious.MvvmCross.Binding.Bindings.Target.MvxPropertyInfoTargetBinding.SetValue (System.Object value) [0x00000] in <filename unknown>:0 
  at Cirrious.MvvmCross.Binding.Bindings.MvxFullBinding.UpdateTargetFromSource (Boolean isAvailable, System.Object value) [0x00000] in <filename unknown>:0 
InnerException was NullReferenceException: Object reference not set to an instance of an object
      at Cirrious.MvvmCross.Binding.Views.MvxBaseImageViewLoader`1[MonoTouch.UIKit.UIImage].set_ImageUrl (System.String value) [0x00000] in <filename unknown>:0 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000c0] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:228 

画像ローダーと画像パネルをビューフィールドとして定義しましたが、まだうまくいきません。その問題の原因は何ですか?

ありがとうございました。

4

2 に答える 2