File Path for Source Property not work properly

I have "WPF userControl Library" project. In it I have window which has next line of code

   <Image  x:Name="imgInstructionIcon" Source="images/InfoIcon.png" >

and also in project I have "images" folder which contains InfoIcon.png file. But My code didn't see this file and give next error:

Error 58 The file images/InfoIcon.png is not part of the project or its 'Build Action' property is not set to 'Resource'

When I change path to the Source=../images/InfoIcon.png I see my icon in designer but not see in runtime. My project is part of Solution.

Answers


Try the uri pack syntac - Read more here


Set the Source="images/InfoIcon.png", BuildAction to Resource and compile the application. Now you can see in designer as well as runtime.


Try doing as the error says: select the image in the solution explorer, then in the properties set the build action to resource. It should fix your problem.


Need Your Help

Maintain a separate branch for each platform

c git cross-platform branching-and-merging

I'm trying to port my project to another platform and I've found a few differences between this new platform and the one I started on. I've seen the autotools package and configure scripts which are

PowerShell script returning the wrong screen resolution

winforms powershell winapi screen-resolution

I just wrote a simple PowerShell script to get the screen resolution of my monitor, but it seems to be returning the wrong values.