Keep ResourcesDictionary on WPF MVVM

If you initialize your viewmodels inside the App Constructor, the resourcesdictionaries with all the resources are missing. In order to keep them, after trying and trying, you must initialize the viewmodel in:

protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
MainVM = new MainViewModel();
MainVM.Initialize();
}

And that’s all, you can keep your application the most pure MVVM. Read my previous MVVM tagged articles to learn how to.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s