Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EventToCommand don't exist in Mvvmlight toolkit WPF4.5

Tags:

wpf

mvvm-light

I'm using the latest MVVMLight Tookit at version 4.1.26.24928, and I'm writing a program using WPF 4.5.

Now I can't use the EventToCommand in VS2012 XAML file, it says "EventToCommand" does not exist in the namespace "clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.WPF45".

My dll references are:

System.Windows.Interactivity (v4.5.0.0)

Galasoft.MvvmLight.WPF45 (v4.1.26.24928)

Galasoft.MvvmLight.Extras.WPF45 (v4.1.26.24928)

This is my code:

namespaces:

xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.WPF45"

the textblock:

<TextBlock>
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="MouseDown">
            <cmd:EventToCommand></cmd:EventToCommand>
        </i:EventTrigger>
    </i:Interaction.Triggers>
</TextBlock>

Am I did somthing wrong?Thank you!

like image 798
TinySnake Avatar asked Jan 13 '13 07:01

TinySnake


1 Answers

I had a similar problem, using VS2013. Mine said:

EventToCommand does not exist in the namespace "http://www.galasoft.ch/mvvmlight"

Which sounded like nonsense since everything seemd to match... and the project was runing after rebuild/clean/whatever.

Solution:

1) Using NuGet (right-click on project in Solution Explorer) I uninstalled the "MVVM Light Libraries only" (it asked if I wanted to uninstalled the related CommonServiceLocator, I said: yes, whatever)

Rebuild, (just in case) It gave a lot of errors as expected, the ones about EventToCommand were still there.

2) Using NuGet I now installed the "MVVM Light Libraries only". Rebuilt and now it works. No errors, no warnings, rock on ;-)

like image 182
wojjas Avatar answered Sep 20 '22 16:09

wojjas