views:

884

answers:

1

If I have a ResourceDictionary in one project, is it possible to create another project that uses resources defined in the first project? Note that both projects are WPF Applications, not ControlLibraries.

Thanks!!

+6  A: 

Yes, of course that's possible, as long as Project B has a reference to Project A.

<ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="/Project A;component/YourSubFolder/YourResourceFile.xaml" />
</ResourceDictionary.MergedDictionaries>

Then you can just use the Resources defined in YourResourceFile.xaml.

Oh snap. I'm giving that a try! Thanks!!
Pwninstein
I didn't know this - cool trick!
Paul Betts
What happens if the projects don't share a reference? In my case I'm using PRISM and declaring styles in the Shell. I'd like to be able to reuse some of the defined colours.
R4cOON
If the Styles are defined in the Shell, then every object can use them, I think. Since the XAML is loaded into the MainPage at runtime, it also gets access to the global Resources.