I had a very annoying problem when I did a simple WPF program. I just wanted to test something and I wanted my program to display an image. This is what I did:
1. Create a new WPF application in Visual Studio.
2. Create a folder in my project with the name "images". Add an image to this folder on disk.
3. Right click the images-folder and select add existing item. The image is added and it is set to "Resource".
4. In Window1.xaml set the following code:
Title="Test" Height="500" Width="650">
<Image Source="images/1.jpg" />
5. When running this code it works ok, but when I want to see it in the Visual Studio Designer I get an exception saying:
Error 1 The file /images/1.jpg is not part of the project or its 'Build Action' property is not set to 'Resource'.
Solution: Rename the image to something like img1.jpg. I do not know why this happen but it works if you rename the image-file. You could rename it to 2.jpg and it will work. Anyone?