UIVIEwController没有.xib,我不确定这是否是问题的一部分.
public overrIDe voID VIEwDIDLoad(){ base.VIEwDIDLoad(); var set = this.CreateBindingSet<HomeVIEw,Homeviewmodel>(); set.Bind(Title).To(vm => vm.Projectname); set.Apply();}
这是堆栈跟踪
2014-02-05 17:09:35.740 TerraFlex[9145:907] 02-05-2014 17:09:35:7403 :1: [Info] HomeVIEw loaded
Thread started: #12
2014-02-05 17:09:36.219 TerraFlex[9145:907] 02-05-2014 17:09:36:2190 :1: [Fatal] A critical error occurred and the application was closed
2014-02-05 17:09:36.250 TerraFlex[9145:907] 02-05-2014 17:09:36:2497 :1: [Fatal] Date: 5/02/2014 5:09:36 PM,[Exception]
Fatal
Message: Object reference not set to an instance of an object
Stack: at CirrIoUs.MvvmCross.Binding.Bindings.Target.Construction.MvxTargetBindingFactoryRegistry.TryCreateSpecificFactoryBinding (System.Object target,System.String targetname,IMvxTargetBinding& binding) [0x00001] in c:\Projects\Misc\MVVMCROSS\CirrIoUs\CirrIoUs.MvvmCross.Binding\Bindings\Target\Construction\MvxTargetBindingFactoryRegistry.cs:69
at CirrIoUs.MvvmCross.Binding.Bindings.Target.Construction.MvxTargetBindingFactoryRegistry.CreateBinding (System.Object target,System.String targetname) [0x00001] in c:\Projects\Misc\MVVMCROSS\CirrIoUs\CirrIoUs.MvvmCross.Binding\Bindings\Target\Construction\MvxTargetBindingFactoryRegistry.cs:22
at CirrIoUs.MvvmCross.Binding.Bindings.MvxFullBinding.CreateTargetBinding (System.Object target) [0x00003] in c:\Projects\Misc\MVVMCROSS\CirrIoUs\CirrIoUs.MvvmCross.Binding\Bindings\MvxFullBinding.cs:135
at CirrIoUs.MvvmCross.Binding.Bindings.MvxFullBinding..ctor (CirrIoUs.MvvmCross.Binding.MvxBindingRequest bindingRequest) [0x00014] in c:\Projects\Misc\MVVMCROSS\CirrIoUs\CirrIoUs.MvvmCross.Binding\Bindings\MvxFullBinding.cs:60
at CirrIoUs.MvvmCross.Binding.Binders.MvxFromTextBinder.BindSingle (CirrIoUs.MvvmCross.Binding.MvxBindingRequest bindingRequest) [0x00001] in c:\Projects\Misc\MVVMCROSS\CirrIoUs\CirrIoUs.MvvmCross.Binding\Binders\MvxFromTextBinder.cs:55
at CirrIoUs.MvvmCross.Binding.Binders.MvxFromTextBinder+<>c_displayClass1.b_0 (CirrIoUs.MvvmCross.Binding.Bindings.MvxBindingDescription description) [0x00000] in c:\Projects\Misc\MVVMCROSS\CirrIoUs\CirrIoUs.MvvmCross.Binding\Binders\MvxFromTextBinder.cs:37
at System.linq.Enumerable+c__Iterator102[CirrIoUs.MvvmCross.Binding.Bindings.MvxBindingDescription,CirrIoUs.MvvmCross.Binding.Bindings.IMvxUpdateableBinding].MoveNext () [0x00000] in <filename unkNown>:0
1 bindings,System.Object clearKey) [0x00028] in c:\Projects\Misc\MVVMCROSS\CirrIoUs\CirrIoUs.MvvmCross.Binding\BindingContext\MvxBindingContextOwnerExtensions.cs:69
at CirrIoUs.MvvmCross.Binding.BindingContext.MvxBindingContextOwnerExtensions.AddBindings (IMvxBindingContextOwner vIEw,IEnumerable
at CirrIoUs.MvvmCross.Binding.BindingContext.MvxBindingContextOwnerExtensions.AddBindings (IMvxBindingContextOwner vIEw,System.Object target,IEnumerable1 bindingDescriptions,System.Object clearKey) [0x00019] in c:\Projects\Misc\MVVMCROSS\CirrIoUs\CirrIoUs.MvvmCross.Binding\BindingContext\MvxBindingContextOwnerExtensions.cs:90
1[System.String].Apply () [0x00000] in :0
at CirrIoUs.MvvmCross.Binding.BindingContext.MvxBindingContextOwnerExtensions.AddBinding (IMvxBindingContextOwner vIEw,CirrIoUs.MvvmCross.Binding.Bindings.MvxBindingDescription bindingDescription,System.Object clearKey) [0x0000e] in c:\Projects\Misc\MVVMCROSS\CirrIoUs\CirrIoUs.MvvmCross.Binding\BindingContext\MvxBindingContextOwnerExtensions.cs:83
at CirrIoUs.MvvmCross.Binding.BindingContext.MvxBaseFluentBindingDescription
at CirrIoUs.MvvmCross.Binding.BindingContext.MvxFluentBindingDescriptionSet`2[Trimble.TFM.FIEldApp.HomeVIEw,Trimble.TFM.FIEldApp.Common.Homeviewmodel].Apply () [0x00000] in :0
谢谢,
乔恩
set .Bind(<target object for bind>) .For(<property on target object>) // leave this out to use the "default binding property for the target object" .To(<property/Expression on source object>) .WithConversion(<converter>,<converter parameter>) // optional .OneWay() // optional - also: OneWayToSource(),TwoWay() or OneTime() .FallbackValue(<value to use for UnsetValue>(); // optional
您可以在以下网址了解更多相关信息
> https://github.com/MvvmCross/MvvmCross/wiki/Databinding#wiki-fluent
你的约束力是:
set.Bind(Title).To(vm => vm.Projectname);
所以你有约束力:
> .Bind(Title) – 当前Title对象中的任何内容(通常为null)
>对于该对象的默认绑定属性(取决于对象类型),请参阅https://github.com/MvvmCross/MvvmCross/blob/v3.1/Cirrious/Cirrious.MvvmCross.Binding.Touch/MvxTouchBindingBuilder.cs#L104作为基本列表
>到DataContext上的Projectname(通常是您的viewmodel)
我想你想要的是:
set.Bind(this).For(v => v.Title).To(vm => vm.Projectname);
我想你也可以这样做:
set.Bind().For(v => v.Title).To(vm => vm.Projectname);
话虽如此,Mvx堆栈不应该真正禁止具有空目标和属性 – 它不习惯 – 所以我将这个作为一个问题添加到调查并添加回归测试为什么TryCreateSpecificFactoryBinding不能处理null.
总结以上是内存溢出为你收集整理的Mvvmcross(iOS)绑定UIViewController的标题全部内容,希望文章能够帮你解决Mvvmcross(iOS)绑定UIViewController的标题所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)