You need to specify a link to the ResourceDictionary in the app.xaml file or locally. Resources in app.xaml are available globally for all application app.xaml files.
For Xaml files in library projects, the designer works a little differently.
At run time, the launch project will have app.xaml , which will be used for all builds. At the time of design, this will be the local build app.xaml . This means that you can add the app.xaml file to libraies, which will only be used by Visual Studio Designer when rendering xaml files from this particular library (Set build action of the file to Page).
To reference a ResourceDictionary do the following:
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="pack://application:,,,/ASSEMBLYNAME;component/FOLDERPATH/RDNAME.xaml" /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> </Application>
Where ASSEMBLYNAME is the name of the assembly, where is ResourceDictionary (check project properties).
Example:
A project with the assembly name: "MyAssembly" and ResourceDictionary in the path to the "Resources / RDs / MyRd.xaml" folder
Source="pack://application:,,,/MyAssembly;component/Resources/RDs/MyRd.xaml"
Anders
source share