Load WPF styles or other static resources from an external file or assembly

I have several WPF applications, and I want all my styles to be in a common assembly, rather than declaring them in each application separately.

I’m looking for a way, so I don’t need to change all my Style="{StaticResource BlahBlah}" in existing applications; I just want to add a link to this assembly of styles and remove it from the current application, so it is taken from the assembly.

Is there any way?

+61
styles wpf xaml assemblies resourcedictionary
Apr 01 '09 at 18:02
source share
1 answer

Link to external ResourceDictionary (XAML file):

 <Application.Resources> <ResourceDictionary Source="MyResources.xaml" /> </Application.Resources> 

Link to external ResourceDictionary (DLL):

 <Application.Resources> <ResourceDictionary Source="/MyExternalAssembly;component/MyResources.xaml" /> </Application.Resources> 
+108
Apr 01 '09 at 19:10
source share



All Articles