The name "Interaction" does not exist in the namespace "http://schemas.microsoft.com/expression/2010/interactivity"

Viewed 67468

I've used the System.Windows.Interactivity DLL in several projects without any problem. Now in my latest project I can't get it to work. I always get the following error:

The name "Interaction" does not exist in the namespace "http://schemas.microsoft.com/expression/2010/interactivity".

<i:Interaction.Triggers>
    <EventTrigger EventName="SelectionChanged">
        <i:InvokeCommandAction Command="{Binding AddSelectLocomotifCommand}"
            CommandParameter="{Binding SelectedItem, ElementName=listBoxLocs}" />
    </EventTrigger>
</i:Interaction.Triggers>

And the namespace:

xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"

Both Microsoft.Expression.Interactions and System.Windows.Interactivity are added to the projects references and I even copied the DLL's to a folder within my project.

Any idea how this comes? I use VS2012 with .NET 4.5

10 Answers
  1. Remove any project reference to Microsoft.Expression.Interactions and System.Windows.Interactivity.

  2. Install through Nuget the newer Microsoft.Xaml.Behaviors.Wpf, which replaces the aforementioned references, i.e. open the Package Manager console and type:

    Install-Package Microsoft.Xaml.Behaviors.Wpf ProjectName

  3. In the Xaml-files, replace the xmlns namespaces http://schemas.microsoft.com/expression/2010/interactivity and http://schemas.microsoft.com/expression/2010/interactions with http://schemas.microsoft.com/xaml/behaviors

I removed the missing references Microsoft.Expression.Interactions AND System.Windows.Interactivity. Then I installed Nuget package Microsoft.SDK.Expression.Blend by Hansan Pringle. This is installed the missing references.

I also solved this stupid issue by removing manually the 2 references (i didn t modify any installation either on my machine neither on the build machine):

  • Microsoft.Expression.Interactions
  • System.Windows.Interactivity from

installed the package: Blend

pushed to the build pipeline this diff:

diff

I would like to update this question as I found a very easy solution which I'm uncertain was given at the time when this question was initialy raised. Now days you can download a nuget package which will, automatically, fit itself into your solution.

The package is called "Expression.Blend.Sdk" (by Microsoft) and it contains the version of System.Windows.Interactivity which includes the a version of InvokeCommandAction which has the Command property.

It's easy to belive that you should install "Blend.Interactivity.Wpf" (by Microsoft) but this nuget package contains another implmentation (I would guess) that doesn't provide a InvokeCommandAction which has the Command property.

As SQL and Java Learner said in a comment:

Open the VS Installer and ensure that the Blend SDK is installed, when you do this, you'll have a reference to the 4.5 version without having to modify the config file or some other file. Failing to have the Blend SDK installed means you won't be able to change it from 4 to 4.5.

This worked for me.

Maybe it could help someone, this problem can be solved by installing the "Blend for Visual Studio SDK for .NET" component, that can be found in Visual Studio 2017 installation:

enter image description here

If you are using VS2019, but have a VS2017 license available, nothing is needed. Just install VS2017 (core) along with this single individual component.

Related