【发布时间】:2020-07-22 10:26:58
【问题描述】:
我想通过调用命令操作来使用 Prism EventTrigger,但在更高版本的 Visual Studio 中出现错误,尤其是 .Net Framework 4.0 及更高版本。 prism 库中进行了哪些更新来解决此问题?我无法使用 InvokeCommandAction 调用已绑定到 ViewModel 的命令。下面是代码sn-p和报错信息截图。
<igwpf:OutlookBarGroup x:Class="PrismOutlook.Modules.Mail.Menus.MailGroup"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:PrismOutlook.Modules.Mail.Menus"
xmlns:ig="http://schemas.infragistics.com/xaml"
xmlns:igwpf="http://schemas.infragistics.com/xaml/wpf"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:prism="http://prismlibrary.com/"
prism:ViewModelLocator.AutoWireViewModel="True"
Header="Mail">
<Grid>
<ig:XamDataTree ItemsSource="{Binding Items}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="ActivaeNodeChanged">
<prism:InvokeCommandAction Command="{Binding SelectedCommand}" TriggerParameterPath="NewActiveTreeNode.Data" />
</i:EventTrigger>
</i:Interaction.Triggers>
<ig:XamDataTree.GlobalNodeLayouts>
<ig:NodeLayout Key="GlobalLayout" TargetTypeName="NavigationItem" DisplayMemberPath="Caption"/>
</ig:XamDataTree.GlobalNodeLayouts>
</ig:XamDataTree>
</Grid>
</igwpf:OutlookBarGroup>
她是我在解决方案输出中看到的错误消息。
我是 Prism 的新手,但对 WPF 和 MVVM 框架有很好的经验。实际上,我正在关注 Brian Lagunas 的 Youtube 教程,我意识到这是一个旧教程,并且可能对 Prism 源代码和构建进行了一些修改,存在兼容性问题。我用的是Visual Studio 2019,项目配置是.NetFramework 4.7.2,当前安装的prism版本是7.2.0.1422。
提前感谢您为解决此问题提供的帮助。
【问题讨论】:
-
能否请您显示您的代码、错误以及您使用的 Prism 版本?