添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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

Ask Question

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

In my projects I use this namespace xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" – Deffiss Dec 23, 2013 at 12:53 When did this start to happen? When you uninstalled VS2010? Or when you uninstalled Blend SDK? – Boluc Papuccuoglu Dec 23, 2013 at 13:03 I didn't uninstalled anything, I just installed VS2012 prof. But its since I installed VS2012 – PitAttack76 Dec 23, 2013 at 13:31
  • Remove any project reference to Microsoft.Expression.Interactions and System.Windows.Interactivity.

  • 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

  • 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

  • Just to add you need to change all the using references too from interactions/interactivity to behaviors as mentioned in answer. – Renascent Feb 2, 2022 at 12:29

    If you have this problem before everything else double check if you have reference to both Microsoft.Expression.Interactions AND System.Windows.Interactivity.

    I just want to warn, that I tried to do everything like PitAttack76 wrote on his answer and it didn't uninstall Blend for me. It just uninstall some parts so when I restart my computer and want to open the project in Blend it writes an error message as in this thread. Than I have to install .NET framework 4.5.1 and Microsoft Build Tools 2013 to Blend start working again. Nevertheless it didn't help me in any way - my problem was, that I have only Microsoft.Expression.Interactions in my references.

    Ok, I've got it fixed. When I installed Visual Studio 2012 Professional (with Blend), I had the option to install Blend for Visual Studio. I thought that maybe that caused the problem so I opened the installer again, choosed Modify and unchecked the option Blend for Visual Studio.

    And guess what, it worked. No more errors on the Interaction. This now works fine again! What the actual issue is, I don't know so if anyone does know, do please tell me :)

    <i:Interaction.Triggers>
        <i:EventTrigger EventName="MouseDoubleClick">
            <i:InvokeCommandAction Command="{Binding AddSelectLocomotifCommand}"
                                                         CommandParameter="{Binding SelectedItem, ElementName=listBoxLocs}" />
        </i:EventTrigger>
    </i:Interaction.Triggers>
    
  • Remove Microsoft.Expression.Interactions and System.Windows.Interactivity from the project in Visual Studio while keeping the xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" namespace.
  • Open the same project in Blend.
  • Add the correct .net versions of Microsoft.Expression.Interactions and System.Windows.Interactivity back in Blend (in my case it was 4.5).
  • Just removing them and adding them again in VS solved it for me. I think you're right - it was an incorrect version. – Joe Jul 26, 2018 at 11:36 I didn't open in Blend, but did remove them and added the latest version of each - solved it for me – Matt Fellows Jan 2, 2019 at 16:09

    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:

    pushed to the build pipeline this 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.

    Ok, I created a wpf app on the latest net 7.0 framework, and I got the following error.

    Severity Code Description Project File Line Suppression State Error XDG0008 The name "Interaction" does not exist in the namespace "http://schemas.microsoft.com/expression/2010/interactivity". ModuleA C:\Trials\Ex\LearnWpfPrism\src\apps\200700-NavigationParmsStart\ModuleA\Views\PersonList.xaml 20

    So in my case replacing the following

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

    with this

    xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
    

    Solved the issue.

    How did you change the version from 4 to 4.5? That seems to be the issue that I'm having as well. – SQL and Java Learner Oct 9, 2017 at 10:47 I did that and that didn't work. The issue for me was that I did not have the reference to the Blend SDK. For anyone else who hasn't found a solution... 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. – SQL and Java Learner Oct 16, 2017 at 12:57

    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

    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:

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

    Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.