menu

Questions & Answers

C# WPF inserted image shows in editor but not in runtime

So i am simply trying to display an image like this

<StackPanel Width="800"
            Grid.Row="2"
            Orientation="Horizontal"
            Margin="0,30,0,240">

<Image Opacity="100" Visibility="Visible" Width="140" Grid.Column="0" Grid.Row="3" Margin="5"                  Source="/Images/Hearts/Ace.png" />
</StackPanel>

It shows up in my editor, just like it should, but when i run it the image is gone, any soloutions?

Image showing the editor view - https://ibb.co/FYNm1J2

I tried Changing the filestructure, and different soloutions i found online.

I expected this to work without problems

Comments:
2023-01-17 00:49:23
What is "build action" and "copy to the output" for the image file?
2023-01-17 00:49:23
Build Action should be Resource, Copy to Output Directory is irrelevant, but should of course be Do not copy.
Answers(0) :