我怎样才能在一个WPF应用程序相结合MVVM和依赖注入? [英] How can I combine MVVM and Dependency Injection in a WPF app?
问题描述
能否请您给的你将如何使用(你喜欢的)DI框架来连线MVVM视图模型一个WPF应用程序的例子吗?
Can you please give an example of how you would use (your favorite) DI framework to wire MVVM View Models for a WPF app?
您将创建一个强查看模型 - 连通层次结构(如,每一个嵌套控制的视图模型是对父母的视图模型的属性,你把它绑定到嵌套控件的DataContext在XAML),或者你会使用某种偶数更抽象的视图模型经理 ,维护中弱连接的层次......就像在CAB,也许?
Will you create a strongly-connected hierarchy of View Models (like where every nested control's ViewModel is a property on a parent's ViewModel and you bind it to nested control's DataContext in XAML) or you would use some kind of even-more-abstract ""View Model" Manager", which maintains some weakly-connected hierarchy... like in CAB, maybe?
推荐答案
看一看团结和棱镜有一系列视频的麦克Taulty的是,这里开始 链接到项目完成。
Take a look at Unity and Prism there's a series of video's by Mike Taulty that start here complete with links to the projects.
这篇关于我怎样才能在一个WPF应用程序相结合MVVM和依赖注入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!