Visual Studio 2017 - What happened to Expression interactions?

29,452

Solution 1

Use the Visual Studio 2017 installer to install "Blend for Visual Studio SDK for .NET", which you can find on the "Individual components" page, under the "SDKs, libraries, and frameworks" heading.

Solution 2

A little update as for 2020:

As mentioned by Jan in other question:

Microsoft open-sourced XAML Behaviours and posted a blog post how to update to this version.

Steps to proceed with update:

  1. Remove reference to “Microsoft.Expression.Interactions” and “System.Windows.Interactivity”.
  2. Install the Microsoft.Xaml.Behaviors.Wpf NuGet package.
  3. 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
  4. C# files – replace the usings in c# files “Microsoft.Xaml.Interactivity” and “Microsoft.Xaml.Interactions” with “Microsoft.Xaml.Behaviors”

Solution 3

CallMethodAction is defined in Microsoft.Expressions.Interactions.dll. This assembly is not part of the .NET Framework but you can download it using NuGet: https://www.nuget.org/packages/MicrosoftExpressionInteractions/

And the InvokeCommandAction class is defined in System.Windows.Interactivity.dll assembly: https://www.nuget.org/packages/System.Windows.Interactivity.WPF/

Share:
29,452
amnesia
Author by

amnesia

Updated on July 09, 2022

Comments

  • amnesia
    amnesia almost 2 years

    I make extensive use of Expression interactions' CallMethodAction to handle events from XAML in a MVVM-friendly way.

    I have just created a new WPF project in VS2017 and now I see the old Expression namespace is gone. I found this page on MSDN which is the action I'm looking for but after referencing that assembly and adding the namespace it does not contain the CallMethodAction. That page is for Silverlight and this is WPF, so I'm concerned that action is no longer available.

    So does anyone know if it has in fact been removed/replaced? How is one supposed to call event handlers on the viewmodel now?

    (I do know about InvokeCommandAction, but I prefer CallMethodAction since it relays the original event arguments, and allows for canceling preview events.)

    Edit: Just to move forward I tried InvokeCommandAction but it no longer works the same way either and I cannot find any documentation on the new usage.

    I did find this reference on MSDN for the Microsoft.Xaml.Interactions namespace which appears to contain the classes I need, but that assembly doesn't appear to exist.

    I feel like I'm missing something obvious here. I don't see how they could make a breaking change to something as basic as responding to events.

  • amnesia
    amnesia over 7 years
    The linked ExpressionInteractions is an old and unofficial version, I already had the latest bundled with VS2017 Enterprise. The key was installing System.Windows.Interactivity.WPF which also installed the current version of EI and gave me the familiar namespaces and functionality. I had always just used the core System.Windows.Interactivity assembly before, never had to install from nuget, so I guess this is the change. Thanks!
  • amit jha
    amit jha about 7 years
    this is the recommended solution
  • amnesia
    amnesia almost 7 years
    Sorry for retroactively changing the accepted answer, but @nmarler's solution below is actually the correct one.
  • amnesia
    amnesia almost 7 years
    Yep, changed my answer, thanks. I hadn't noticed this.
  • Tấn Nguyên
    Tấn Nguyên about 6 years
    I knew it was old, but the .NET Framework 4.5 seemed not working as I have tested 2 nugets above. I recommend use this nuget.org/packages/Expression.Blend.Sdk/1.0.2
  • James McDuffie
    James McDuffie over 5 years
    Solved my problem. I have seen lots of people using the NuGet package, but I prefer to use the one that comes with Blend.