Showing a Screen with dependencies

Nov 2, 2010 at 1:29 PM

i was wondering how you would go about showing a screen with dependencies

this is what i have been able to come up with for now. but I don't like that i'm getting a dependency on the container here.

windowManager.Show(IoC.GetInstance(typeof (SomeViewModel), null));
//configuration of the screen

so i was wondering if anyone had any tip & tricks for instantiating Screens with dependencies

Nov 2, 2010 at 2:30 PM

Consider injecting a factory method such as, Func<SomeViewModel>, and calling that to create the instance rather than relying on the container. Most IoC containers have an equivalent capability.