没有 Prism 的 WPF UI 组合
对于 UI 组合(区域管理等),是否有 Prism 的替代方案?
谢谢。
Are there any alternatives to Prism for UI composition (region management etc.)?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
方法有很多种,但目前最流行的方法是 MEF。本系列文章是关于 Silverlight UI 组合的,但技术本质上是相同的(除了打包和部署之外):
http://codebetter.com/glennblock/category/hellomef/
您唯一赢得的东西无法完全使用 MEF 的是 Prism 中称为“EventAggregator”的 Pub/Sub 通信技术,但这可以通过使用 EventAggregator 本身轻松替代(它是独立的......您不必采用所有 Prism 来使用就是这样),或者您可以使用事件代理的另一种实现,例如 MVVM Foundation 中的 Messenger (http://mvvmfoundation.codeplex。 com)。
还有不少人混合使用 MEF 和 Prism,因此您也可以检查一下。
There are a few ways, but the one that is all the rage these days is MEF. This series of posts is about Silverlight UI composition, but the techniques are essentially the same (aside from packaging and deployment):
http://codebetter.com/glennblock/category/hellomef/
The only thing you won't get by using exclusively MEF is the Pub/Sub communication technology in Prism called "EventAggregator", but this can be easily substituted by using EventAggregator itself (it is standalone... you don't have to adopt all of Prism to use just that) or you can use another implementation of event brokering, like the Messenger in MVVM Foundation (http://mvvmfoundation.codeplex.com).
There are also quite a few people using a mix of MEF and Prism, so you might check that out as well.