Mathi901
Mathi901

Reputation: 245

WPF application. How to reference image in xaml code, so another user can view them when running .exe file of the project?

I'm having a problem with my wpf application. I have two images in the xaml code, and when I run the application on my computer, they appear well, but when I ask someone to run the .exe file, the application run but the images don't appear. How can I set the images source so that when another user run the .exe file, the images appear in the screen?

The xaml image source code:

Source="\\MULINFSV0005\User$\mathias.deitos\Meus Documentos\Visual Studio 2013\Projects\WpfApplication2\WpfApplication2\clock.png"

Upvotes: 0

Views: 870

Answers (1)

Anastasia Melnikova
Anastasia Melnikova

Reputation: 106

If an image is in the project folder so probably the problem is in it's Properties.

Build Action: Resource

Copy to Output Directory: Do not copy

In xaml something like this <Image Source="../../Images/yorImage.png"/> The path to the image from the place where you're (mean from the current file to the image file. If both files are in the same directory Source="image.png"

This should work.

Upvotes: 1

Related Questions