之前版本是通過安裝 Blend SDK 支持 Behaviors 庫的,但是這個方法都是通過引用 dll 的方式,不夠優(yōu)雅。在升級到 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
|