我有一个iOS预约应用程序运行Xamarin Studio中的Mono 2.10.11。MVVMCross界限按钮事件不会触发按
约会详细信息屏幕允许约会根据他们的结果进行评分。基于业务逻辑的布尔集合显示允许评级的按钮。绑定的按钮触发打开评级屏幕。它可以在iOS 6.1的Mobile和Debugger以及iOS 7模拟器上正常运行。它不适用于iOS 7设备。
的AppointView.cs包含函数的viewDidLoad其如下设置按钮: -
AppointmentViewTable.Source = _source;
this.AddBindings (new Dictionary<object, string>
{
{ _source, "{'ItemsSource':{'Path':'AppointmentDetails'}, 'HeaderTitle':{'Path':'Appointment.AppointmentDate','converter':'DateTime'}}" },
{ btnRateSession, "{'Hidden':{'Path':'Appointment.RateAvailable','converter':'InvertedVisibility'}, 'Title':{'Path':'TextSource','Converter':'Language','ConverterParameter':'btnRateSession'}, 'TouchDown':{'Path':'GoToSessionRateView'}}"}
});
通过创建约会看法,我得到以下警告的运行程序: -
2013-10-18 16:58:55.012 M2FitiOS[3773:a0b] MvxBind: Error: 14.12 Problem seen during binding execution for from Appointment.RateAvailable to Hidden - problem InvalidCastException: Null object can not be converted to a value type.
at System.Convert.ToType (System.Object value, System.Type conversionType, IFormatProvider provider, Boolean try_target_to_type) [0x00017] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Convert.cs:2553
at System.Convert.ChangeType (System.Object value, System.Type conversionType, IFormatProvider provider) [0x00017] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Convert.cs:2204
at Cirrious.MvvmCross.Binding.ExtensionMethods.MvxTypeExtensions.MakeSafeValue (System.Type propertyType, System.Object value) [0x00000] in <filename unknown>:0
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
该AppointmentViewModel包含事件: -
public ICommand GoToSessionRateView
{
get
{
return new MvxRelayCommand(() => RequestNavigate<SessionRateViewModel>(new { appointmentId = _appointmentId }));
}
}
ñ确定是什么原因导致该事件停止工作。任何指针将不胜感激。
有些东西是空的。修复。另外我会推荐使用最新版本的MvvmCross。 – Cheesebaron