Reputation: 105
I need to specify a local resource to a external class that I use. I have tried several combinations and I cant make the class load my resources. The resources are compiled with Build Action set to Resource and both dlls are dynamically loaded. I have tried the following URI's based on pack uris in WPF:
"pack://application:,,,/LocalAssemblyName;component/Resource"
"pack://application:,,,/LocalAssemblyName;/Resource"
"pack://application:,,,/Resource"
None of them worked. I'd like to know what am I doing wrong.
Upvotes: 1
Views: 1261
Reputation: 1620
In my App.xaml
I'm using references to resources located in another assembly like this:
<Application ... >
<Application.Resources>
<ResourceDictionary>
...
<!-- This loads a whole ResourceDictionary: -->
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/LocalAssemblyName;Component/ResourcDictionaries/YourResources.xaml" />
</ResourceDictionary.MergedDictionaries>
...
<!-- Like this you can load resources one by one: -->
<BitmapImage x:Key="_icon_save" UriSource="pack://application:,,,/LocalAssemblyName;Component/SingleResources\disk12.ICO" />
...
</ResourceDictionary>
</Application.Resources>
</Application>
Hope it helps.
Upvotes: 1