There is a picture <Image Source="pack://application:,,,/bin/debug/NOAVATAR.jpg"> In the window constructor, it sees and displays it, when the program starts it does not. If you initialize it in the class constructor, you cannot find the resource, but how is it, if it IS in the window ??? Help pliz!
|
1 answer
Based on /bin/debug/ , I think you are doing something wrong.
To begin with, the picture needs to be added to the project:
Make sure that the Build Action is set to Resource, and copying to the output directory is disabled:
Now the picture can be connected via the path inside the project:
<Image Source="pack://application:,,,/Resources/bg.png"/> Note that in the project, the picture is in the Resources directory, and this corresponds to the path in the pack URI.
- thank! helped - Awesome7997
- @ Awesome7997: Please! - VladD
- @VladD Did everything according to your answer and still did not help. And in the constructor, the image is displayed correctly, but after the assembly of the exe, the image disappears! The second day I can not understand what is happening. - Sergey
- @ Sergey: Well, it's hard to say what is wrong. The question is, what is your path to the file in the project, and what is the pack URI. - VladD
- @VladD figured out. In one character was wrong only. Plus your answer! - Sergey
|

