以前版本是经过安装 Blend SDK 支持 Behaviors 库的,可是这个方法都是经过引用 dll 的方式,不够优雅。在升级到 dotnet core 3.0 的时候就须要使用 WPF 官方团队开源的 Microsoft.Xaml.Behaviors.Wpf 库代替c#
先经过 NuGet 安装 Microsoft.Xaml.Behaviors.Wpf 库windows
或者在 csproj 添加下面代码spa
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf"> <Version>1.1.19</Version> </PackageReference>
将代码里面的引用 System.Windows.Interactivity
库的内容作替换code
将 xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
替换为 xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
就能够了,这样就能解决找不到 System.Windows.Interactivity
没法构建成功xml
c# - How to add System.Windows.Interactivity to project? - Stack Overflowget