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


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!
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top