C# 构造函数注入Win8应用程序

C# 构造函数注入Win8应用程序,c#,dependency-injection,inversion-of-control,constructor-injection,C#,Dependency Injection,Inversion Of Control,Constructor Injection,如何在Win8应用程序中实现DI和IoC? 在windows窗体中,如果我需要一个带有在构造函数中传递的依赖项的窗体(构造函数注入) 但佩奇怎么办? 如果我用这个构造函数构建一个页面( 然后 Navigate (typeof (HomePage)) 如何传递参数?您可以使用Frame的内容而不是源代码来解决问题: myFrame.Content = new HomePage (MyService1 ms, MyService2 ms); myFrame.Content = new Home

如何在Win8应用程序中实现DI和IoC? 在windows窗体中,如果我需要一个带有在构造函数中传递的依赖项的窗体(构造函数注入) 但佩奇怎么办? 如果我用这个构造函数构建一个页面(

然后

Navigate (typeof (HomePage)) 

如何传递参数?

您可以使用
Frame
内容而不是
源代码来解决问题:

myFrame.Content = new HomePage (MyService1 ms, MyService2 ms);
myFrame.Content = new HomePage (MyService1 ms, MyService2 ms);