Using resource dictionaries in modules

The most common issues regarding this subject are:

If a ResourceDictionary is defined in the Shell project, this ResourceDictionary will not be available in design time in a module. (In runtime, the ResourceDictionary will be resolved correctly):

In this case, it would be worth noting that it’s possible to define application-wide resources out of the box, which will work in all modules. However, this doesn’t seem to work with the designer, when checking a view in a module. A possible work around would be to include the source path for the ResourceDictionary as a resource in the App.xaml file of the module doing something similar to this:

<ResourceDictionary Source="/ShellProject;component/Resources/Resource.xaml"/>

While the App.xaml file in a module isn’t consumed when running the application, it is used in design-time.

If a ResourceDictionary is defined in a module (to be used specifically inside the module), the ResourceDictionary will not be available at runtime:

For this case, you might find the approach proposed in the following blog post by Guido Maliandi useful:

Last edited Jan 20, 2012 at 8:03 PM by DCherubini, version 2


AlanMc Jun 13, 2013 at 7:00 PM 
Does this work with WPF (non silverlight) applications? You cannot add an ApplicationDefinition to a class library in WPF because it fails to compile and I do not want my modules to be compiled into .exe's. If it works, I need more information about how to get the App.xaml / App.xaml.cs into the project.