WPF dotnet core 的 Blend SDK Behaviors 库

之前版本是通过安装 Blend SDK 支持 Behaviors 库的,但是这个方法都是通过引用 dll 的方式,不够优雅。在升级到 dotnet core 3.0 的时候就需要使用 WPF 官方团队开源的 Microsoft.Xaml.Behaviors.Wpf 库代替

先通过 NuGet 安装 Microsoft.Xaml.Behaviors.Wpf

或者在 csproj 添加下面代码

      <PackageReference Include="Microsoft.Xaml.Behaviors.Wpf">
          <Version>1.1.19</Version>
      </PackageReference>

将代码里面的引用 System.Windows.Interactivity 库的内容做替换

xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" 替换为 xmlns:i="http://schemas.microsoft.com/xaml/behaviors" 就可以了,这样就能解决找不到 System.Windows.Interactivity 无法构建成功

c# - How to add System.Windows.Interactivity to project? - Stack Overflow

posted @ 2020-05-21 18:59  lindexi  阅读(589)  评论(0编辑  收藏  举报