0

Below is in a flow document
I can see all 5 in design
When I run the program then none are found
How can I get relative path to work?

<Paragraph>
    <Image Width="50" Height="50" Source="zHelpMain.png" Stretch="Fill"/>
</Paragraph>
<Paragraph>
    <Image Width="50" Height="50" Source="Images\VennIntersection.png" Stretch="Fill"/>
</Paragraph>
<Paragraph>
    <Image Width="50" Height="50" Source="/Gabe2a;component/Images/VennUnion.png" Stretch="Fill"/>
</Paragraph>
<Paragraph>
    <Image Width="50" Height="50" Source="/Images/helpMain.png" Stretch="Fill"/>
</Paragraph>
<Paragraph>
    <Image Width="50" Height="50" Source="images\helpMain.png" Stretch="Fill"/>
</Paragraph>

enter image description here

8
  • See stackoverflow.com/questions/1444699/… ? Commented Dec 17, 2014 at 21:47
  • How do you store image files in the assembly? Commented Dec 17, 2014 at 21:51
  • @HamletHakobyan I just have them in those locations in my project. I don't understand your question. Commented Dec 17, 2014 at 21:53
  • @Blam, are they defined as resources in your project? (check the "Build action" property) Commented Dec 17, 2014 at 21:54
  • @ThomasLevesque The problem is that the files do not have a build action property. I will try and post an image. Commented Dec 17, 2014 at 21:55

2 Answers 2

3

1). You have to add all Image files to your WPF project, for example, place them in Img directory; by default Build Action will be set to 'Resources'. Keep it intact.

2). Specify path to the image like:

Source="/[assembly name];component/Img/ImageFile

Pertinent to your particular case, the following syntax looks OK:

Source="/Gabe2a;component/Images/VennUnion.png"

Hope this will help. Best regards,

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

Comments

0

Currently the image files are part of the solution, but not part of the project, so they're not embedded in the assembly when you compile. You need to add the to the Gabe2a project, with the build action set to "Resource".

2 Comments

How do I add them to the project? I have tried add existing item and they end up in that Solution Items. And not build option.
OK I finally figured it out. Your words were clear enough. I was blinded by the light. Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.