Silverlight Prism:如何更改新页面的外壳布局?
我是 Silverlight/Prism 新手,因此不确定如何呈现新的布局页面。我已经让 Shell 像母版页一样工作,但我希望应用程序中的多个页面具有不同的布局母版。那么,如何获得另一个(外壳)或布局页面来排列不同的区域? 感谢您提供任何概念性反馈!
I am new to Silverlight/Prism, so not sure how a new layout page would be rendered. I've got the Shell working like a master page, but I want to have several pages in the application with a different layout master. So, how do I get another (shell) or layout page to arrange different regions?
Thanks for any conceptual feedback!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您是否考虑过让 Shell 视图包含 ContentControl 或 ItemsControl,以便您可以通过编程方式加载不同的视图。这些不同的视图可以包含区域或任何您想要的内容。
我还记得PRISM就像自助餐,你可以挑选要使用的部分。查看 ItemsControl 和 ContentControl 后,请考虑提供哪些区域。
Have you considered having your Shell view contain either a ContentControl or a ItemsControl so that you can programmatically load different views. These different views could then contain regions or whatever you wanted.
I'd also remember that PRISM is likened to a buffet, you can pick and choose which parts to use. Once you look at ItemsControl and ContentControl consider what regions offer.
将 Prism 区域视为母版页似乎总是会导致混乱。它的设计目的并不是(像 ASP.Net)潜在地在出现的每个页面周围呈现一个新的 shell。这是为浏览器创建的 ->服务器->根据每个请求重新创建页面的浏览器模型。
要实现母版页样式场景,您真正要做的就是提供一个外壳的选择,这些外壳定义了相同的区域名称,但具有不同的视觉效果或位置。通过根视觉中的元素/区域更改外壳将导致所有子区域重新填充到它们的新家中。
就我个人而言,我将 Silverlight 更像是一个桌面应用程序,而不是一个网站。我放弃了母版页的想法(因为它感觉倒退),只使用动态样式进行整体更改。
希望这有帮助。
Treating Prism regions like Master pages seems to always lead to confusion. It is not designed (like ASP.Net) to potentially render a new shell around every page that appears. That was created for a Browser -> Server -> Browser model where the page is recreated on every request.
To implement a master page style scenario all you are really doing is providing a choice of outer shells that have the same region names defined, but in different visuals or positions. Changing the shell via an element/region in the root visual will cause all the child regions to repopulate in their new homes.
Personally I treat Silverlight more like I would a desktop application and less like a website. I dropped the idea of Master pages (as it feels backwards) and just use dynamic styling for overall changes.
Hope this helps.
以下线程处理类似的情况。我希望它有用。
谢谢,
达米安.
The following thread deals with a similar situation. I hope it is useful.
Thanks,
Damian.