I don't understand why I cannot display an image in WPF. Maybe I modified my resources folder accidentally and that is the reason why I does not get displayed. So I created a new wpf application and I have this:
and when I run the program my picture gets displayed as:
Why is it that when I try doing the same thing in my program the image does not show up!?
note how when I run the program there is no image...
In my other application I just dragged the image control to my main window and then I browsed for a random image on my computer and when I complied and run it it works fine. Why is it that I cannot do the same with the application that I am working with?
EDIT:
with some images it works and with others it does not! why?
take a look:
and when I compile and run one image does not show up!
and also take a look and see how the files have the same properties.
settings for folder image:
settings for mov image:
Chances are the Image does not have the Build Action set to Resource. If it's anything else, including Embedded Resource, then it will not display properly at runtime.
Other things you can check are the the resolution of the image. In Paint, you'd use File>Properties to view the resolution.
Try saving as a different format, such as jpg. If that works, then it's likely a problem with your file.
You may need to clean and rebuild your solution as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With