Reputation: 15282
Basically, I want to keep all my XAML resources in an external assembly (for my styles). I have a reference of this external assembly in my application.
Is there something to do with satellite assemblies or whatnot or how do I go about accessing these styles so that my application can still have StaticResource tags without compilation errors?
Upvotes: 4
Views: 4674
Reputation: 15999
Assuming you keep your styles in a ResourceDictionary
in the other assembly, you just need to merge it with your current resources (whether they are on a Window
or UserControl
or whatever).
If we assume that
ResourceDictionary
is under the namespace Resources; and...then you can merge the dictionaries as below:
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary
Source="pack://application:,,,/external.assembly.name;component/Resources/MyStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
<!-- other resources go here -->
</ResourceDictionary>
</UserControl.Resources>
Upvotes: 6