If you are using a resource dictionary file, you need to access the files using the Pack URI Scheme . For instance:
The following example shows the package URI for the XAML resource file, which is located in the root of the specified directory of the assembly project.
pack:
The following example shows the package URI for the XAML resource file, which is located in a subfolder of the link folder of the assembly project.
pack:
The following example shows the package URI for the XAML resource file, which is located in the root folder of the referenced version of the project assembly.
pack:
If the file is in the output folder, you can use the origin site to link to it:
The following example shows the package URI for the site of origin of the XAML file stored in the location from which the executable assembly is running.
pack:
The following example shows the package URI for the site of origin of the XAML file stored in a subfolder that refers to the location from which the executable assembly of the application is launched.
pack:
As an example:
<UserControl.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="pack://siteoforigin:,,,/Assets/OpenIconsDictionary.xaml"/> <ResourceDictionary Source="pack://application:,,,/Gui;component/Assets/PackedIconsDictionary.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </UserControl.Resources> <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <BitmapImage x:Key="Icon" UriSource="pack://siteoforigin:,,,/Images/image.png"/> </ResourceDictionary> <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <BitmapImage x:Key="Icon" UriSource="pack://siteoforigin:,,,/Images/image.png"/> </ResourceDictionary>
Arash source share