WPF Resources from other DLL’s
I spent a little bit of time trying to figure this out, to be honest – it’s available in quite a few locations on google, but I thought I’d add it here as well. The basic problem is, you have your template / theme etc for your control in a separate project;
MyThemes : DateTimeThemes/Theme1.xaml
etc
and you want to use this as a resource for your control, how?
You add into your Resources element (be it in Window.Resources or UserControl.Resources), like so:
<ResourceDictionary Source="/MyThemes;component/Themes/Theme1.xaml" />
What’s important here is that the word ‘component’ is as spelt, you don’t replace it with anything (like ‘MyComponent’ for example), just leave it as is.
/MyThemes
is the name of the dll, which isn’t necessarily the name of the project – (though that would only change if you’ve changed those properties).
Thank you for this information.