This project has moved and is read-only. For the latest updates, please go here.


Dec 27, 2012 at 7:28 PM

Why the hell this fucking little thing doesn't work in VS 2012 ???




Dec 27, 2012 at 7:42 PM

Assuming that you work with WPF4 indeed, it should be


What happens when you try that?


Dec 27, 2012 at 8:11 PM

Sorry for my first post, I was upset...


I'm using .NET 4.5, with the MVVM Light 4.5 WPF project template, so I assume the good assemblies are referenced.

When I try to use EventToCommand in this XAML: 

<Rectangle Fill="BlueViolet"
                 Width="{Binding Width}"
                 Height="{Binding Height}">
    <i:EventTrigger EventName="MouseDown">

I lost the intelisence and when I try to put cmd:EventToCommand tag VS tell me that: 

`Error 1 The name "EventToCommand" does not exist in the namespace "clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.WPF4".`


Thanks for your answer.

Dec 27, 2012 at 8:13 PM


No worries.

For WPF 4.5, you need to use the correct assembly name GalaSoft.MvvmLight.WPF45 and not GalaSoft.MvvmLight.WPF4.

Side note: There is a reason why I am using the WPF45 in the assembly name, but I am reconsidering it and it is very possible that I will remove that from a future version of MVVM Light.

Let me know if it still doesn't work with the correction.


Dec 27, 2012 at 8:14 PM

BTW in VS12, you can type simply xmlns:cmd= and then VS12 should open an Intellisense window proposing the correct namespaces to you.



Dec 27, 2012 at 8:54 PM

I already tried with 45, but it didn''t worked at all (VS send an error).

In the intellisense pop up there's only the 4 version ("clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.WPF4").

Dec 27, 2012 at 8:58 PM
Edited Dec 27, 2012 at 8:58 PM


It sounds like you are using the WPF 4 DLLs with a WPF 4.5 project. Can you send me the project and I'll take a look.


Dec 27, 2012 at 9:10 PM
Edited Dec 27, 2012 at 9:10 PM

Even when I create a new MVVM Light WPF 45 project, it adds dlls for .NET 4:

Dec 27, 2012 at 9:18 PM

Seems that you are absolutely right. The project template is faulty. You are the first to report this issue, sorry for that.

I will fix it ASAP. In the meantime, please download the following Zip file:

Then right click on the zip file and select Properties. Click on the Unblock button. Then extract the file.

In your project, remove the WPF 4 references and replace with the WPF 4.5 references. In the XAML, use WPF45 instead of WPF4.

Sorry for the inconvenience, but thanks for reporting the issue. 


Dec 27, 2012 at 9:48 PM

Thanks for your answers.

Jan 7, 2013 at 5:45 AM
Edited Jan 7, 2013 at 6:17 AM

I have been struggling with EventToCommand and MouseMove.  I have tried binding to my ViewModel and to my View, but nothing fires.  Please help..

I am working with Silverlight 4, NOT WPF.  I think I saw somewhere that EventToCommand does not work with Silverlight except for the Load event.  Bbut for the life of me I can not find that post again.

I have pasted my code and XAML below for your review.  Thanks!



    Public Shared ReadOnly MouseMoveCommandProperty As DependencyProperty = DependencyProperty.Register("MouseMoveCommand", GetType(RelayCommand(Of MouseEventArgs)), GetType(MyViewModel), Nothing)
    Public Property MouseMoveCommand As RelayCommand(Of MouseEventArgs)
            If GetValue(MouseMoveCommandProperty) Is Nothing Then
                Return New RelayCommand(Of MouseEventArgs)(Sub(e) MyMouseMove(e))
                Return DirectCast(GetValue(MouseMoveCommandProperty), RelayCommand(Of MouseEventArgs))
            End If
        End Get
        Set(ByVal value As RelayCommand(Of MouseEventArgs))
            Me.SetValue(MouseMoveCommandProperty, value)
            RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(MethodBase.GetCurrentMethod().Name.Substring(4)))
        End Set
    End Property


    Public Sub MyMouseMove(e As MouseEventArgs)
        Dim p As Point = e.GetPosition(e.OriginalSource)
    End Sub


<Canvas x:Name="MyCanvas" Cursor="{Binding ActionType, Source={StaticResource MyVM}, Mode=OneWay, Converter={StaticResource ActionToCursor}}" 

                        <cmd:EventToCommand Command="{Binding MouseMoveCommand, Source={StaticResource MyVM}}" PassEventArgsToCommand="True"/>
Jan 7, 2013 at 6:13 AM
Edited Jan 7, 2013 at 6:14 AM

For what it is worth...  This works fine:

        Public _initializeSystemCommand As ICommand = New SystemEx.Commands.DelegateCommand(AddressOf InitializeSystem, AddressOf CanExecute)
        Public Property InitializeSystemCommand() As ICommand
                Return _initializeSystemCommand
            End Get
            Set(ByVal value As ICommand)
                _initializeSystemCommand = value
            End Set
        End Property

        Private Sub InitializeSystem(parameter As Object)
            'Do something interesting
        End Sub

<Canvas Height="768" Width="1024" Background="LightGray" Cursor="Arrow" DataContext="DrawingVM" >
            <i:EventTrigger EventName="Loaded">
                <i:InvokeCommandAction Command="{Binding InitializeSystemCommand, Source={StaticResource DrawingVM}, Mode=TwoWay}" CommandParameter="L" />


Jan 7, 2013 at 6:23 AM

Here is a cut and paste out of your on Drag&Drop with EventToComand....  However, I can confirm that the code does NOT execute or I would receive notification of the mouse move through Messaging which notifies other elements of the event.


An issue with Visual Studio 2010

In the course of preparing this article, I noticed an issue in Visual Studio 2010 when I attempt to debug the HandleDropCommand implementation. Even with a breakpoint placed within the code, the debugger does not break. I am not sure right now what is the reason, and the code does get executed, but this complicates debugging of course. I am investigating and talking to Microsoft about that, but right now I am not sure where it comes from.

Jun 3, 2013 at 4:01 PM
Hello Mr. Bugnion,

I am using MVVM Light toolkit with WPF4.5. I am facing the same issue reported by Yield.

I removed assemblies from my project and added those from zip you suggested, still VS2012 not able to find EventToCommand. And following error message are displayed.

Error Messages:
The type 'cmd:EventToCommand' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.
The name "EventToCommand" does not exist in the namespace "clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.WPF45".

I have also added following xmlns (using IntelliSence) as you suggested however VS2012 still not working.

Can you please help with this?

Jun 4, 2013 at 9:08 AM
Hi Laurent,

In-case you want the code, please let me know How can I send it to you?

Jun 26, 2013 at 10:48 AM
Edited Jun 26, 2013 at 10:48 AM
Hi, I recently updated to the latest SL5 version using nuget and exactly hit the same error

Using VS 2012
GalaSoft.MvvmLight.Extras.SL5 (
GalaSoft.MvvmLight.SL5 (

Tried namespaces

The name "EventToCommand" does not exist in namespace....

Help would be really appreciated
Jun 27, 2013 at 12:15 PM
I am still not able to solve this issue. I tried out everything I can. I think a new thread should be started for this issue.
Jul 26, 2013 at 3:28 PM
I believe you need the "Extras" library. EventToCommand is not part of MVVM Light Essentials. Try xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WPF45"
Jul 26, 2013 at 3:45 PM
Edited Jul 26, 2013 at 3:46 PM
I believe you need the "Extras" library. EventToCommand is not part of MVVM Light Essentials. Try xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WPF45"
Jul 29, 2013 at 7:31 AM
Same issue here.
I tryed with
without success.
So I defined a
using GalaSoft.MvvmLight.Command;
namespace MyNamespace.Common.Views
    public class MyEventToCommand : EventToCommand
in code behind and then it works great:
 <views:MyEventToCommand Command="{Binding MyCommand}"
                        PassEventArgsToCommand="True" />
Jul 29, 2013 at 7:38 AM
Oh, that Ioc. Sorry, my falut.

Apr 8, 2014 at 2:28 PM
Edited Apr 8, 2014 at 2:31 PM
this discussion is fucking codeplex gold. i laughed so hard just seeing this at google results page.
Apr 29, 2015 at 4:00 PM
OK. Same problem, but it is April 2015. The .WPF45 assemblies are not available from NuGet and Laurent talked about getting rid of these so I am assuming that is the case.

When adding the cmd namespace below, intellisence finds it in the assembly with no problem. When I look at the assembly with object explorer, EventToCommand is there.
But my XAML cannot 'see' the EventToCommand:
    <i:EventTrigger EventName="ItemClicked">
        <cmd:EventToCommand Command="{Binding Mode=OneWay, Path=LoadDataCommand}"/>
The name "EventToCommand" does not exist in the namespace "clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight"
Again, when I look at the assembly with object explorer, EventToCommand is there.

So, any ideas?
Apr 30, 2015 at 8:53 PM
Edited Apr 30, 2015 at 8:53 PM
Ok, figured out the problem. The EventToCommand is no longer in the GalaSoft.MvvmLight assembly. It is now located in the GalaSoft.MvvmLight.Platform assembly.

The clr-namespace in the XAML should look like this: