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

Issue with EventToCommand in VS2012 (Update2)

Apr 16, 2013 at 4:43 PM
Edited Apr 16, 2013 at 4:45 PM

I'm using the latest build of MVVM Light, we use a mixture of Prism and MVVM Light as we much prefer the RelayCommand in MVVM Light, the superb Messenger and the EventToCommand behavior for binding to our VM's. Prism is mainly used for modularity and region management. The project is VS2012 (Updated2), win7 64bit, .NET4.5 & Telerik Rad Controls.

I'm using the following libs:

GalaSoft.MvvmLight.Extras.WPF45 (v4.0.30319) (via nuget today)
GalaSoft.MvvmLight.WPF45 (v4.0.30319)
System.Windows.Interactivity (v4.0.30319)


In this particular view, Prism is not used so that can be disregarded as the Shell has a ViewModelLocator.

The markup is as follows:
<UserControl x:Class="Company.Framework.Shell.View.StatusBar"
             DataContext="{Binding Source={StaticResource Locator}, Path=StatusBar}"
             d:DesignHeight="300" d:DesignWidth="300">

                <ResourceDictionary Source="pack://application:,,,/Company.Framework.Resource;Component/SharedResources.xaml"></ResourceDictionary>
        <StatusBar DockPanel.Dock="Bottom">

            <StatusBarItem DockPanel.Dock="Left">

            <Separator DockPanel.Dock="Left" />

            <StatusBarItem DockPanel.Dock="Left">

            <Separator DockPanel.Dock="Left" />

            <StatusBarItem DockPanel.Dock="Left">

            <Separator DockPanel.Dock="Left" />

            <StatusBarItem DockPanel.Dock="Left">

            <!-- Last item is docked in center, as usual. -->
            <StatusBarItem HorizontalAlignment="Center">

            <!-- Define quick module preview button -->
            <Separator DockPanel.Dock="Left" />
            <StatusBarItem HorizontalAlignment="Right">
                <telerik:RadRibbonToggleButton  Name="radradiobutton_titlebartoggle" 
                                                    SmallImage="{StaticResource statusbar_toogle_quickview_16x16}"
                                                    ToolTip="Show or hide the module quick access area">
                            <i:EventTrigger EventName="Checked">
                            <commands:EventToCommand Command="{Binding ToogleCommand}" CommandParameter="{Binding ElementName=radradiobutton_titlebartoggle, Path=IsChecked}" />
                            <i:EventTrigger EventName="Unchecked">
                                <commands:EventToCommand Command="{Binding ToogleCommand}" CommandParameter="{Binding ElementName=radradiobutton_titlebartoggle, Path=IsChecked}" />
The EventToCommand behavior works as expected but I'm getting an unstable environment in the XAML designer. I have the view open and the following error is reported but it compiles ok:
Error   1   Cannot create an instance of "TriggerActionCollection". D:\TFS\Company.Framework\Source\Company.Framework.Shell\View\StatusBar.xaml 63  29  VShips.Framework.Shell
Any ideas what's causing this behaviour?



(ps: thanks for a great framework)
May 7, 2013 at 10:35 AM
Any ideas on this one?
Jul 15, 2013 at 2:42 PM
Bump. Experiencing the same issue.
Jul 15, 2013 at 2:46 PM
cswimmer wrote:
Bump. Experiencing the same issue.
At least it's not just me. The app compiles ok but it's a problem as the more junior team members see the compile error and assume there's an issue.
Jul 21, 2013 at 1:07 PM

Typically these issues are caused by an old version of the System.Windows.Interactivity.dll. Unfortunately, because this DLL gets installed by the Blend SDK, it is possible that Visual Studio replaces the reference to this DLL in your application with the one that was installed with Blend. It is very important to make sure that you always use the latest version of this DLL otherwise the application will work but the design time experience will get impacted negatively.

Jul 22, 2013 at 9:49 AM
Edited Jul 22, 2013 at 11:09 AM
Hi Laurent,

Thanks for your reply.

I appear to have three versions of this library on my machine (Win7 x64).

My project appears to be pointing at the library.

I take it is the correct one to use with the MVVM Light WPF45 libraries?


EDIT: seems to resolve the issue (C:\Program Files (x86)\Laurent Bugnion (GalaSoft)\Mvvm Light Toolkit\Binaries\WPF45\System.Windows.Interactivity.dll) v4.0.30319
Jul 22, 2013 at 7:59 PM

Happy that it solved the issue. Normally I distribute the latest version of this DLL, but if you have an earlier version of the Blend SDK installed, it is possible that Studio redirects the reference to the installed version, even if it is not as recent. It is a real PITA and I have talked to the Blend team about this, I hope that they stop increasing version numbers and/or giving strong names to that assembly.

Note that the version number is not directly related to ,NET 4.0 vs 4.5 but rather VS10 vs VS12 (eg Blend 4 vs Blend 5).