C#C
C#17mo ago
Denis

Sharing PNG/SVG resources between WPF projects

I have a set of images that need to be displayed within my WPF Views.
Assuming I only need and have a single project, adding said resources to it, setting them to Resource in the properties, and then referencing via their respective paths is sufficient and works.
E.g.:
  1. Create a WPF project
  2. Add a folder called Resources
  3. Place a PNG image into the Resources folder
  4. Set the image item type to be Resource
  5. Reference the image via pack://application:,,,/Resources/Color.png or /MyWPFProjectName;component/Resources/Image.png
Unfortunately, I'm failing to make it work with a multiple projects, where a one of them serves to share images, and the rest reference them (assuming I use a path like /MySharedImageProject;component/Resources/Image.png).
I'd prefer to have a system similar to how DevExpress does it via a MarkupExtension: https://docs.devexpress.com/WPF/DevExpress.Xpf.Core.DXImageExtension#remarks

Any pointers you could give me on how to share image resources between projects?
Developer documentation for all DevExpress products.
Was this page helpful?