How to use a WPF resource from a source assembly in another assemb

  • Thread starter Thread starter BartMan
  • Start date Start date
B

BartMan

Greetings,

I currently have one custom control assembly where I am defining default
styles in this assembly in a resource directory. I am use this common dll to
define styles and how they should look throughout my application.

It works great with an application, but now what I am trying to do is use
these styles in a assembly which has specific controls on it I would also
like to use this theme. When I add the resource files to this other assembly
it complains that it doesn't exist.

Here is my new assembly where I want to use the themes from my common
assemblies resource dictionary.

<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:MyTestNamespace">
<!-- Add the MyCommon User Interface Look -->
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary
Source="pack://application:,,,/MyCommonLibrary;component/Themes/generic.xaml"
/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

I also have a normal Window object in this library, how can I get this
window to use this style? myTestStyle is defined in the common assemblies
generic.xaml.
Style="{StaticResource myTestStyle}" >

Thanks for any suggestions!
 
Back
Top