Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Image doesn't appear during debugging

Tags:

c#

image

wpf

Following problem: I just have an Image box on my window with following XAML Code:

<Image x:Name="image1" HorizontalAlignment="Left" Height="100" Margin="261,161,0,0" VerticalAlignment="Top" Width="100" Stretch="Fill" IsHitTestVisible="True" Source="Resources/Jellyfish.jpg"/>

There are no errors and the image is shown in editing mode: Screenshot 1

But when I debug the program, the Image doesn't appear :( Screenshot 2

Does anybody see a mistake?

Regards MightyM

like image 393
MightyM Avatar asked Feb 01 '26 04:02

MightyM


1 Answers

All you have to do is

  1. Ensure the your project has a folder called Resources
  2. Your Resources folder has a file called jellyfish.jpg
  3. The properties window of JellyFish.jpg shows the the Build Action is set to "Resource"

3 will ensure that the JellyFish.jpg is embedded into your assembly as a resource stream. If you don't want an embedded resource you can look at PACK URI for your other choices

like image 119
parapura rajkumar Avatar answered Feb 02 '26 18:02

parapura rajkumar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!