Reputation: 17392
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
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
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
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