Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c#

ios

mvvmcross

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.

like image 595
borrrden Avatar asked Dec 03 '13 04:12

borrrden


1 Answers

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

like image 191
Stuart Avatar answered Nov 09 '22 20:11

Stuart