Intellisense doesn't work for MVVM light toolkit

久未见 提交于 2019-12-02 02:20:07

You have to use it like this ..

Namespace to add :
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"

<i:Interaction.Triggers>
    <i:EventTrigger EventName="Loaded">
        <mvvm:EventToCommand Command="{Binding Path=UserControlLoadedCommand}" />
    </i:EventTrigger>
</i:Interaction.Triggers> 

Dont forget to add a reference to System.Windows.Interactivity to your project

You need To Use PassEventArgsToCommand="True" in

<i:Interaction.Triggers>
    <i:EventTrigger EventName="Loaded">
        <mvvm:EventToCommand Command="{Binding Path=UserControlLoadedCommand}" PassEventArgsToCommand="True" />
    </i:EventTrigger>
</i:Interaction.Triggers> 

And then you can get that at ViewModel ..... you Might Need to use Generic RelayCommand as

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