I'm trying to set up dependency injection in a new WPF project using the framework Caliburn Micro and Ninject. Unfortunately I'm not succeeding :( There are a few examples on the internet which implement a generic Bootstrap but for me the generic Bootstrap class is not available and since all these examples are at least 3 years old I guess they are deprecated...
What I've tried is the following:
public class CbmBootstrapper : BootstrapperBase
{
private IKernel kernel;
protected override void Configure()
{
this.kernel = new StandardKernel();
this.kernel.Bind<IAppViewModel>().To<AppViewModel>();
}
}
And in the App.xaml
<Application x:Class="CBMExample.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:local="clr-namespace:CBMExample"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<local:CbmBootstrapper x:Key="bootstrapper" />
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
I am very new to WPF and Ninject. Can you tell me what I have to change, so that at startup of the application, the View (AppView) with the corresponding ViewModel (AppViewModel) gets loaded?
Do you know of any up-to-date tutorial on using & setting up Ninject with Caliburn Micro?