我有一個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