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

此生再无相见时 提交于 2019-12-10 13:48:25

问题


The tutorial N=5 of the N+1 days of MvvmCross builds fine in Xamarin Studio when downloaded. However, if I update the assemblies from 3.0.5 to 3.0.14, the iOS project no longer builds. 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'

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. The odd thing is that the two lines above it binding to regular properties work fine, but the ICommand binded stuff fails.


回答1:


Since N=5 was filmed, xamarin have added their own pcl support

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.

This System.Windows assembly contains a type forwarding definition of ICommand - and this should clear your compilation error



来源:https://stackoverflow.com/questions/20342667/is-there-a-different-method-to-bind-ios-icommands-in-mvvmcross-3-0-14

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!