WPF 与 MVVM 和 Prismv2 - 事件冒泡?

发布于 2024-08-26 09:16:35 字数 305 浏览 6 评论 0原文

将事件从子模块或孙模块传递到父 Shell 的最佳方法是什么?

例如,如果我在模块中的视图实际上距离 Shell 2 个级别,并且我有一个 窗口行为。事件聚合器真的是做到这一点的最佳方法吗?这似乎有点矫枉过正。我只希望我的 MainShell 能够监视所有子模块中 ViewModel 上 IsDialogOpen 属性的更改。我感觉我只见树木不见森林了……

What is the best way to get an event from a child or grandchild module up to the parent Shell?

For instance, if I have a view in a module that is actually 2 levels away from the Shell, and I have a Window behavior. Is the eventaggregator really the best way to do this? it seems like overkill. I just want my MainShell to watch for a change in the IsDialogOpen Property on the ViewModels in all my child modules. I feel like I am missing the trees for the forest...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

离旧人 2024-09-02 09:16:35

我实际上通过 wpf 4 和 VisualStateManager 实现了这一点。

I actually achieved this with wpf 4 and visualStateManager.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文