d.moncada
d.moncada

Reputation: 17392

Best way to access images outside of a project?

I currently have several WPF projects that need to access a folder of images. What would the best way be to allow the projects to have access to the same images folder w/out duplication?

example structure:

I'm familiar w/ adding the "needed" images to the actual project itself, but am looking for a solution for the projects to have the same "central" library of images.

Upvotes: 2

Views: 1062

Answers (3)

Gayot Fow
Gayot Fow

Reputation: 8792

If you wanted to reduce the size of your deployed assembly and to keep the image files 'loose', you might consider the 'site of origin' scheme. It is the same format, but uses 'siteoforigin' for the authority rather than 'application'.

pack://siteoforigin:,,,/Subfolder/SiteOfOriginFile.jpg

Upvotes: 1

Joy George Kunjikkuru
Joy George Kunjikkuru

Reputation: 1528

You can have the path to those images in your application.This will avoid the copy of images in your project. But if you package installer you need to package them properly.

Upvotes: 0

Aaron McIver
Aaron McIver

Reputation: 24713

You can place all your images in a central project and reference them via the pack syntax throughout your solution.

ImageSource="pack://application:,,,/MyProject;component/Images/MyImage.png"

Upvotes: 4

Related Questions