I’ve seen how to load an image in Silverlight and how to load an image in WPF, but I can’t figure out how to load an image using the same XAML for the Silverlight and WPF flavors of a composite Prism app. Ideally I’d like to do something like:
<Image Source="/Resources/Images/foo.png"/>
A relative URI that uses the component notation won’t work because the Silverlight and WPF assemblies are named differently (on purpose, for sanity). I’m using Silverlight 4 and .NET 4.0.
You could do the following. Define URIs for images in a separate resource dictionary. Then WPF and Silverlight projects will define their own dictionaries that will be referenced by the shell project. Here is an example:
–