I have a project which requires an image in the window. This is a static image and i added through \'Add>Existing Item\'. It exists in the root of the project.
I re
Try doing a full rebuild, or delete the build files and then build the file.
Visual Studio doesn't always pick up changes to resources, and it can be a pain to get it recompile.
Also try using a full URI as that helped me when I had the same problem. Something like
pack://application:,,,/MyAssembly;component/bug.png
I had the same error message but my issues was a simple NOOB mistake.
When I added my .ico files to "My Project / Resources", VS made a sub folder named Resources and I was trying to use;
<Window Icon="icons1.ico">
when I should have been using;
<Window Icon="Resources/icons1.ico">
... don't judge, I started using WPF 1 week ago :)
There is a solution to your question
<Image Source="/WpfApplication4;component/images/sky.jpg" />
"component" is not a folder!
I faced the exact same issue but restarting VS2008 or cleaning and rebuilding the project did not work for me. In the end, the below steps did the trick.
"Source="Resources/MyImage.ico"
(my image was saved as icon (.ico) file, but this approach should work for any image typeHope this helps someone