I am trying to load a runtime image in WPF using the following code
_image = new Image(); BitmapImage src = new BitmapImage(); src.BeginInit(); src.UriSource = new Uri(@"pack://application:,,,/images/tagimages/placeholder.png", UriKind.Absolute); src.CacheOption = BitmapCacheOption.OnLoad; src.EndInit(); _image.Source = src; _image.Stretch = Stretch.None;
In my project, I have a folder with images and a subfolder in this folder called tagimages, which contains placeholder.png. When I run this code, I get the following error:
"Unable to find resources" images / tagimages / placeholder.png '"
What am I doing wrong?
source share