简体   繁体   English

在MvvmCross 3.0.14中绑定iOS ICommands有不同的方法吗?

[英]Is there a different method to bind iOS ICommands in MvvmCross 3.0.14?

The tutorial N=5 of the N+1 days of MvvmCross builds fine in Xamarin Studio when downloaded. MvvmCross的N + 1天教程N = 5在下载时在Xamarin Studio中构建良好。 However, if I update the assemblies from 3.0.5 to 3.0.14, the iOS project no longer builds. 但是,如果我将程序集从3.0.5更新到3.0.14,则不再构建iOS项目。 The error has to do with these two lines: 错误与这两行有关:

set.Bind(button).To(vm => vm.MyCommand);
set.Bind(button2).To(vm => vm.GoSecondCommand);

The error message is as follows: 错误消息如下:

Cannot convert `lambda expression' to non-delegate type `string' 无法将`lambda expression'转换为非委托类型`string'

Has there been a change to the way this works? 这种方式有变化吗? The object browser shows the correct method taking a Func<TSource, object> but it seems that the compiler wants to use the string version. 对象浏览器显示了采用Func<TSource, object>的正确方法Func<TSource, object>但似乎编译器想要使用string版本。 The odd thing is that the two lines above it binding to regular properties work fine, but the ICommand binded stuff fails. 奇怪的是它绑定到常规属性上面的两行工作正常,但ICommand绑定的东西失败了。

Since N=5 was filmed, xamarin have added their own pcl support 由于拍摄了N = 5,因此xamarin添加了它们自己的pcl支持物

As part of this support, you need to add a project reference for your Touch UI project to System.Windows.dll in the Assemblies part of Add Reference. 作为此支持的一部分,您需要在“添加引用”的“程序集”部分中将Touch UI项目的项目引用添加到System.Windows.dll

This System.Windows assembly contains a type forwarding definition of ICommand - and this should clear your compilation error 此System.Windows程序集包含ICommand的类型转发定义 - 这应该清除您的编译错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM