I am trying to run some code when the main form is loaded. I used the code here. I am using wpf with .NET core 3.1 using the MVVM pattern. When I try to add the nuget package System.Windows.Interactivity
I get an error This package may not be fully compatible with your project
. I am assuming the issue is the version of .NET I am using. Is there a way to make this work for .NET Core 3.1?

- 63,072
- 85
- 231
- 359
-
Install-Package Microsoft.Xaml.Behaviors.Wpf – Andy Mar 22 '20 at 21:28
-
@Andy do I use this like I would with `System.Windows.Interactivity` – Luke101 Mar 22 '20 at 22:18
-
Yes and no. https://devblogs.microsoft.com/dotnet/open-sourcing-xaml-behaviors-for-wpf/ – Andy Mar 23 '20 at 08:22
1 Answers
System.Windows.Interactivity has been replaced by a nuget package.
Instead of referencing that you add the package:
Microsoft.Xaml.Behaviors.Wpf
You will then need an xmlns.
From https://devblogs.microsoft.com/dotnet/open-sourcing-xaml-behaviors-for-wpf/ ( see for more info ).
Steps to migrate are:
Remove reference to “Microsoft.Expression.Interactions” and “System.Windows.Interactivity” Install the “Microsoft.Xaml.Behaviors.Wpf” NuGet package. 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“ C# files – replace the usings in c# files “Microsoft.Xaml.Interactivity” and “Microsoft.Xaml.Interactions” with “Microsoft.Xaml.Behaviors”
This is net core friendly.
It is not exactly like for like and I found one piece of my code incompatible. For most people this is likely a non-issue though.

- 11,864
- 2
- 17
- 20