将 Prism 6.2.0 更新到 8.0 后 WPF InteractionRequest 不工作

WPF InteractionRequest not working after Updating Prism 6.2.0 to 8.0

我已将使用 Prism 6.2.0 构建的 WPF 项目更新为 Prism 8.0。我正在使用 .NET Framework 4.7。

我在我的应用程序中的很多地方使用 InteractionRequest 来打开一个弹出窗口来收集用户信息。更新项目后,出现此错误:

The type or namespace 'InteractionRequest<>' could not be found. Are you missing an assembly reference or a using directive?.

我添加了使用Prism.Interactivity

有人知道如何解决这个问题吗? Prism 8.0 是否弃用了 InteractionRequest?如果是,我该如何替换该功能?

InteractionRequestPopupWindowAction API 已在 Prism 7.2.0.1367 中替换为新的对话服务。以下 GitHub 个问题涵盖了造成这种情况的原因:

引用 Brian Lagunas 的话 release notes:

Currently, the only way to show any type of dialog with Prism is by using the PopupWindowAction in combination with System.Windows.Interactivity. [...] It's over complex, highly verbose, difficult to implement, and is very limited. [...]

Instead, I created a new IDialogService API that will replace the PopupWindowAction altogether. This service will allow developers to show any dialog they want either modal, or non-modal, and have complete control over their dialog logic.

您可以参考dialog service documentation了解如何使用和迁移。另请注意,Prism 8 添加了对多个对话 window 主机的支持,这在 Prism 7.x.

中不受支持