How to specify path to Image resources in WPF application

后端 未结 2 1611
遇见更好的自我
遇见更好的自我 2021-01-26 07:55

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?



        
2条回答
  •  孤独总比滥情好
    2021-01-26 08:43

    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,

提交回复
热议问题