如何将命令绑定到窗体的Loaded事件



我正在尝试在加载主窗体时运行一些代码。我用了这里的代码。我使用的是带有.NET核心3.1的wpf,使用的是MVVM模式。当我尝试添加nuget包System.Windows.Interactivity时,我得到一个错误This package may not be fully compatible with your project。我认为问题出在我使用的.NET版本上。有没有一种方法可以让它在.NET Core 3.1上运行?

System.Windows.Interactivity已被nuget包替换。

不是引用你添加的包:

Microsoft.Xaml.行为.Wpf

然后您将需要一个xmlns。

发件人https://devblogs.microsoft.com/dotnet/open-sourcing-xaml-behaviors-for-wpf/(有关更多信息,请参阅(。

迁移步骤为:

删除对"Microsoft.Expression.Interactions"one_answers"System.Windows.Interactive"的引用安装"Microsoft.Xaml.Phaviors.Wpf"NuGet软件包。XAML文件–替换xmlns命名空间"http://schemas.microsoft.com/expression/2010/interactivity"one_answers"http://schemas.microsoft.com/expression/2010/interactions"与"http://schemas.microsoft.com/xaml/behaviors"C#文件–将C#文件"Microsoft.Xaml.Interactivey"one_answers"Microsoft.Xaml.Interactives"中的using替换为"Microsoft.Xaml/Behaviors">

这是网芯友好型。

这并不是完全一样的,我发现我的一段代码不兼容。不过,对大多数人来说,这可能不是问题。

最新更新