Is Dependency Injection possible with a WPF application?

前端 未结 8 1013
忘了有多久
忘了有多久 2021-01-30 21:05

I want to start using dependency injection in my WPF application, largely for better unit testability. My app is mostly constructed along the M-V-VM pattern. I\'m looking at Aut

8条回答
  •  情话喂你
    2021-01-30 21:42

    Yes, we do it all the time. You can "inject" your ViewModel into the DataContext of the control.

    I actually find WPF being even easier to use with DI. Even the dependency objects and properties work with it seamlessly.

提交回复
热议问题