tags:

views:

24

answers:

3

Hello Friends. 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.

A: 

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.

Matteo Mosca
I already check it. It is Resource
Polaris
That's strange. Have you tried adding it to the project default resx file and using it from there?
Matteo Mosca
No, how can i do this?
Polaris
A: 

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

Ragunathan
Ragu read question attentively. I already do this )))
Polaris
Ragunathan
+1  A: 

Try the uri pack syntac - Read more here

rudigrobler