在 Prism 中动态添加/删除视图的最佳方式 +银光

发布于 2024-09-15 20:34:57 字数 332 浏览 5 评论 0原文

Prism 是否内置支持拥有“组”视图?如果是这样,是如何完成的?我想做的是拥有一个区域,将其称为 WizardRegion,在这里我可以将不同类型的向导加载到该区域。假设我有两个不同的向导:signup 和dowork。每个向导都有四个页面或视图。如果我对每个视图执行正常的 RegisterViewWithRegion() 操作,那么所有八个视图将始终可见。当我切换到注册向导时,我希望显示四个注册视图。当我切换到 dowork 向导时,我希望显示 dowork 的四个视图。

我是否必须编写自己的视图管理器(或扩展)才能完成这项工作?我的想法完全错误吗?请注意,我不想有 SignupRegion 和 DoWorkRegion。

Does Prism have built-in support for having "groups" of views? If so, how is it done? What I'd like to do is have one regin, call it WizardRegion, where I can have different types of wizards load into that region. Let's assume I have two different wizards: signup and dowork. And each wizard has four pages or views. If I do the normal RegisterViewWithRegion() for each view then all eight views will be visible all the time. When I switch to the signup wizard I want the four views for signup to show. When I switch to the dowork wizard I want the four views for dowork to show.

Do I have to write my own view manager (or extensions) to do this work? Am I completely thinking about it incorrectly? Note that I do not want to have a SignupRegion and a DoWorkRegion.

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

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

发布评论

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

评论(1

自控 2024-09-22 20:34:57

是的,您必须自己想出某种视图管理器。我相信有一些框架具有此类功能。

单独使用 Prism,您可以使用事件聚合器服务发送消息以使视图可见/折叠。

如果您正在使用 MVVM,您还可以将这些视图的可见性绑定到设置这些属性的服务/控制器类。

您也可以结合使用两者。

Yes, you have to come up with some sort of view manager on your own. I believe there are some frameworks out there with this sort of functionality.

Using Prism alone you could use the event aggregator service to send messages to make views visible/collapsed.

If you are doing MVVM you could also bind the visibility of those views to a service/controller class where those properties are set.

You can also use a combination of the two.

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