Is it possible to use ninject for dependency injection in such a way that the result would be something like the injection I can get in MVC. To elaborate, if I use the MVC ninject adapter I can declare my web controllers as having constructor parameters which would then automatically be injected by ninject.
However, I haven't found such a ninject extension for WPF, which would enable me to have a window such as this:
public partial class MainWindow : Window
{
private readonly IService injectedService;
public MainWindow(IService injectedService)
{
this.injectedService = injectedService;
}
}
I would like to do this without explicitly using the IKernel
in my main application startup to obtain an instance of mainwindow. I'd much prefer to use the normal method of xaml configuration to obtain an instance of the main window and all subsequent windows.
Is this possible? Is there any way to hook into the object creation generated by xaml to modify it to use Ninject for constructor dependency injection.