如何在WPF应用程序中组合MVVM和依赖注入? [英] How can I combine MVVM and Dependency Injection in a WPF app?
问题描述
你会创建一个强大的视图模型的连接层次结构(如每个嵌套控件的ViewModel是父级ViewModel上的属性,并将其绑定到XAML中的嵌套控件的DataContext),或者您将使用某种甚至更抽象的View ModelManager ,它保持一些弱连接的层次结构...像在CAB中,也许?
看看Unity和Prism有Mike Taulty的一系列视频开始这里填写项目链接。
Can you please give an example of how you would use (your favorite) DI framework to wire MVVM View Models for a WPF app?
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?
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屋!