I am having some problems finding the exact syntax for the URI, so see below for more details:
If your image ( myImage.png ) is in a subfolder of "images" (from the root directory), the exact syntax is:
image.Source = new BitmapImage(new Uri(@"pack://application:,,,/images/myImage.png", UriKind.Absolute));
If your image is located in a subfolder of images/icon/ (from the root directory), the syntax is:
image.Source = new BitmapImage(new Uri(@"pack://application:,,,/images/icon/myImage.png", UriKind.Absolute));
- Note that the
"pack://application:,,, does not change. - Be sure to set Build Action to Resources.
For more information: see here .
Malick
source share