I have defined my resourceDictionary in a separate library as below
You need to provide a reference to the ResourceDictionary
either in the app.xaml
file or locally. Resources in app.xaml
are available globally to all xaml files of the application.
For Xaml files in library projects the designer works a little differently.
At runtime it will be the app.xaml
in the startup project that will be used for all assemblies. At designtime it will be the app.xaml
of the local assembly.
This means, you can add a app.xaml
file to libraies, which will only be used by the Visual Studio Designer when rendering xaml files from that specific library (Set build action of file to Page).
To reference a ResourceDictionary
do this:
Where ASSEMBLYNAME is the name of the assembly where the ResourceDictionary
is (check properties of project).
Example:
Project with assembly name: "MyAssembly" and ResourceDictionary
in folder path "Resources/RDs/MyRd.xaml"
Source="pack://application:,,,/MyAssembly;component/Resources/RDs/MyRd.xaml"