Reputation: 57
I don't know how I can implement the bootstrapper in my project.
In my App class, I create a new thread which it launches my MainWindow which does not have _ViewModel associate.
I know there is ellaborate boostrapper class which it's proposed but I don't how apply in my wpf project.
Anyone can help me?
Upvotes: 2
Views: 2468
Reputation: 71
I hope this help you:
Add a ResourceDictionary in your App.xaml :
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<local:AppBootstrapper x:Key="Bootstrapper"/>
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Add a new class "AppBootstrapper" with using Caliburn.Micro:
public class AppBootstrapper : BootstrapperBase
{
public AppBootstrapper()
{
this.StartRuntime();
}
protected override void OnStartup(object sender,System.Windows.StartupEventArgs e)
{
this.DisplayRootViewFor(typeof(MainViewModel),null);
}
}
At "this.DisplayRootViewFor(typeof("")" add the name of your viewmodel
Upvotes: 2