0

I have a set of images that load from my solutions resource file, now they show up fine in design mode and in Blend but they won't show up at all when I actually run the program.

Here is the markup of the controls

<WrapPanel x:Name="heartsWrapPanel" Height="25.97" Canvas.Left="437.94" Canvas.Top="594.83" Width="75.26">
    <Image x:Name="heart1" Height="22.388" Width="24.777" HorizontalAlignment="Left" VerticalAlignment="Bottom" Source="pack://siteoforigin:,,,/Resources/heart.png"/>
    <Image x:Name="heart2" Height="22.388" Width="24.777" HorizontalAlignment="Left" VerticalAlignment="Bottom" Source="pack://siteoforigin:,,,/Resources/heart.png"/>
    <Image x:Name="heart3" Height="22.388" Width="24.777" HorizontalAlignment="Left" VerticalAlignment="Bottom" Source="pack://siteoforigin:,,,/Resources/heart.png"/>
</WrapPanel>

Now I can't figure out what's wrong, there's nothing wrong with the wrap panel as I've tried to put in other elements in it and they show up fine, and like I said the images show up in design mode and in Blend but it won't show up during runtime.

5
  • Do you see files copied to your output directory? Commented Nov 14, 2014 at 21:27
  • 3
    you have to set the "Build Action" to "Resource" for Images Commented Nov 14, 2014 at 21:29
  • If you start in the debugger (F5), do you see any messages in the output window within visual studio? Commented Nov 14, 2014 at 21:30
  • @Mate Turns out I had to do that and change to Source=Resources/heart.png" Commented Nov 14, 2014 at 21:49
  • @OverlyExcessive Great! I've added as a solution, you can accept it or close the question. Commented Nov 14, 2014 at 22:27

1 Answer 1

2

you have to set the "Build Action" to "Resource" for Images and maybe change to Source=Resources/XXX.png"

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.