WPF and WinRT Image Source using Content Build Action
-
30-06-2021 - |
سؤال
I have a WinRT application and a .NET application which want to share images. I have been using portable class library and want to share as much code as possible. I also want to have only one copy of all images and use the 'Add Link' feature to add images.
My WinRT app uses a build action of 'Content' and I refer to my images using a relative path like so: /Assets/Flags/Australia.png
I have added the images to my .NET application using add link and used the same 'Content' build action but I can't get this working. It only seems to work when I use a build action of 'Resource' and use a full path like so: /MyProject;component/Assets/Flags/Australia.png
I have a model in my portable class libary project which contains a property returning the path to the flag image. Both applications should share this property. How can I achieve this and what build action do I use.
المحلول
It turns out sharing is not possible. I ended up using seperate properties for the path to my images in WinRT and WPF.