将基于 .NET Framework 的 WPF 项目迁移到基于 .NET Core 3 的过程中,发现 System.Windows.Interactivity 已不再被兼容。

以下是具体迁移过程:

1.替换程序包

打开 NuGet 程序包管理器,删除对 Microsoft.Expression.InteractionsSystem.Windows.Interactivity 的引用,并安装 Microsoft.Xaml.Behaviors.Wpf 程序包。

2.更换 xmlns 命名空间

以下是代码示例:

xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" 
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" 

替换为:

xmlns:Behaviors="http://schemas.microsoft.com/xaml/behaviors"

3.更换类文件中的命名空间

Microsoft.Xaml.InteractivityMicrosoft.Xaml.Interactions 替换为 Microsoft.Xaml.Behaviors


更多关于 Microsoft.Xaml.Behaviors.Wpf 的学习,移步 XAMLBehaviorsSample

Like The Article To View All

You May Also Like

You come to this world, You need to see the sun...

All Comments

Leave a Reply Cancel Reply

Tips: Your email address will not be disclosed!

If you can't see clearly,please click to change...