将我的项目更新为Unified API和MVVM Cross 3.5 stable之后,对于所有按钮绑定,我在控制台中收到以下警告消息...
我像这样绑定。
try {
this.AddBindings(
new Dictionary < object, string > () {
//all the command controls - such as buttons
{
btnXmit,
"TouchUpInside cmdXmitClicked"
}, {
btnCancel,
"TouchUpInside cmdBack"
},
});
} catch (Exception error) {
}
在
/Volumes/WORKSPACE/Workspace/V3.5/framework/framework/MvvmCross-3/CrossCore/Cirrious.CrossCore/WeakSubscription/MvxWe52EventSubscription中的Cirrious.CrossCore.WeakSubscription.MvxWeakEventSubscription
2[System.Windows.Input.ICommand,System.EventArgs]..ctor (ICommand source, System.Reflection.EventInfo sourceEventInfo, System.EventHandler
1 targetEventHandler)[0x00028]。在/Volumes/WORKSPACE/Workspace/V3.5/framework/framework/MvvmCross-3/CrossCore/Cirrious中的Cirrious.CrossCore.WeakSubscription.MvxCanExecuteChangedEventSubscription..ctor(ICommand源,System.EventHandler
1 eventHandler) [0x00000] in /Volumes/WORKSPACE/Workspace/V3.5/framework/framework/MvvmCross-3/CrossCore/Cirrious.CrossCore/WeakSubscription/MvxCanExecuteChangedEventSubscription.cs:21 at Cirrious.CrossCore.WeakSubscription.MvxWeakSubscriptionExtensionMethods.WeakSubscribe (ICommand source, System.EventHandler
1 eventHandler)[0x00003] .CrossCore / WeakSubscription / MvxWeakSubscriptionExtensionMethods.cs:68在/Volumes/WORKSPACE/Workspace/V3.5/framework/framework/MvvmCross-3/Cirrious/中的Cirrious.MvvmCross.Binding.Touch.Target.MvxUIControlTouchUpInsideTargetBinding.SetValueImpl(System.Object target,System.Object value)[0x00045] Cirrious.MvvmCross.Binding.Touch / Target / MvxUIControlTouchUpInsideTargetBinding.cs:74
在/Volumes/WORKSPACE/Workspace/V3.5/framework/framework/MvvmCross-3/Cirrious/Cirrious/Cirrious/Cirrious.Cirrious.Cirrious.Cirrious.Cirrious.Cirrious.MvvmCross.Binding中的Cirrious.MvvmCross.Binding.Bindings.Target.MvxConvertingTargetBinding.SetValue(System.Object value)[0x000bd] /Bindings/Target/MvxConvertingTargetBinding.cs:64
在/Volumes/WORKSPACE/Workspace/V3.5/framework/framework/MvvmCross-3/Cirrious/Cirrious.MvvmCross.Binding/Bindings的/Volumes/WORKSPACE/Workspace/V3.5/framework/framework/MvvmCross-3/Cirrious.MvvmCross.Binding.Bindings.MvxFullBinding.UpdateTargetFromSource(System.Object value)[0x00036]中/MvxFullBinding.cs:162
2015-02-16 17:48:14.433 RemoteInspectioniOS [3506:119564] MvxBind:错误:212.37在为cmdBack绑定TouchUpInside的绑定执行期间看到问题-问题ArgumentNullException:MvxWeakEventSubscription中缺少源事件信息
参数名称:sourceEventInfo
在/Volumes/WORKSPACE/Workspace/V3.5/framework/framework/MvvmCross-3/CrossCore/Cirrious.CrossCore/WeakSubscription/MvxWeakEventSubscription中的Cirrious.CrossCore.WeakSubscription.MvxWeakEventSubscription
2[System.Windows.Input.ICommand,System.EventArgs]..ctor (ICommand source, System.Reflection.EventInfo sourceEventInfo, System.EventHandler
1 targetEventHandler)[0x00028]。在/Volumes/WORKSPACE/Workspace/V3.5/framework/framework/MvvmCross-3/CrossCore/Cirrious中的Cirrious.CrossCore.WeakSubscription.MvxCanExecuteChangedEventSubscription..ctor(ICommand源,System.EventHandler
1 eventHandler) [0x00000] in /Volumes/WORKSPACE/Workspace/V3.5/framework/framework/MvvmCross-3/CrossCore/Cirrious.CrossCore/WeakSubscription/MvxCanExecuteChangedEventSubscription.cs:21 at Cirrious.CrossCore.WeakSubscription.MvxWeakSubscriptionExtensionMethods.WeakSubscribe (ICommand source, System.EventHandler
1 eventHandler)[0x00003] .CrossCore / WeakSubscription / MvxWeakSubscriptionExtensionMethods.cs:68在/Volumes/WORKSPACE/Workspace/V3.5/framework/framework/MvvmCross-3/Cirrious/ Cirrious.MvvmCross.Binding.Touch / Target / MvxUIControlTouchUpInsideTargetBinding.cs:74
在/Volumes/WORKSPACE/Workspace/V3.5/framework/framework/MvvmCross-3/Cirrious/Cirrious/Cirrious/Cirrious.Cirrious.Cirrious.Cirrious.Cirrious.Cirrious.MvvmCross.Binding中的Cirrious.MvvmCross.Binding.Bindings.Target.MvxConvertingTargetBinding.SetValue(System.Object value)[0x000bd] /Bindings/Target/MvxConvertingTargetBinding.cs:64
在/Volumes/WORKSPACE/Workspace/V3.5/framework/framework/MvvmCross-3/Cirrious/Cirrious.MvvmCross.Binding/Bindings的/Volumes/WORKSPACE/Workspace/V3.5/framework/framework/MvvmCross-3/Cirrious.MvvmCross.Binding.Bindings.MvxFullBinding.UpdateTargetFromSource(System.Object value)[0x00036]中/MvxFullBinding.cs:162
最佳答案
您需要使用以下代码创建一个LinkerPleaseInclude.cs文件:
public class LinkerPleaseInclude
{
public void Include(ICommand command)
{
command.CanExecuteChanged += (s, e) => { if (command.CanExecute(null)) command.Execute(null); };
}
}
编辑(根据我的评论):
关于binding - Mvvmcross 3.5绑定(bind)显示交战,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/28541931/