ThisHandleNotInUse
ThisHandleNotInUse

Reputation: 1153

Proper URI syntax for referencing public resource file in DLL

Says it all...

I have an XAML Resource Dictionary file (text) in "Resources.resx" under the public class "Resources" accessible by the public method "Styles."

I can find the resource in the standard C# method under the DLL's namespace...

But my problem is when it comes to writing this:

<ResourceDictionary Source="????"></ResourceDictionary>

Everything I've tried for source causes a runtime exception error. So I apparently don't understand the syntax... People keep putting a bunch of commas in these source paths... are they part of the syntax?

Or, is there a more proper method for including XAML resource files in class libraries?

Upvotes: 0

Views: 1227

Answers (1)

Clemens
Clemens

Reputation: 128097

You are looking for a Resource File Pack URI that references a resources in an another assembly:

pack://application:,,,/ReferencedAssembly;component/Subfolder/ResourceFile.xaml

In XAML you can omit the prefix and just write

<ResourceDictionary
    Source="/ReferencedAssembly;component/Subfolder/ResourceFile.xaml"/>

Upvotes: 1

Related Questions