EventToCommand not working when migrate to v4 for

2019-08-17 18:54发布

问题:

I have SL4 app with MVVMLight. I migrate it to SL 5 and got following error when compiling the app:

The tag 'EventToCommand' does not exist in XML namespace 'clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.SL5

The xaml for this error is:

  xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
  xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.SL5"

<i:Interaction.Triggers>
   <i:EventTrigger EventName="MouseLeftButtonUp">
       <cmd:EventToCommand Command="{Binding ResetPasswordCommand,Mode=OneWay}"                                             
        MustToggleIsEnabledValue="True" />
    </i:EventTrigger>
</i:Interaction.Triggers>

quite confused. Have update all assemblies for new platform. How to resolve this problem?

回答1:

Figure it out: should use assembly=GalaSoft.MvvmLight.Extras.SL5 instead of assembly=GalaSoft.MvvmLight.SL5. Thanks.