Embedded Resource Problem

Apr 14, 2010 at 5:16 AM
Edited Apr 14, 2010 at 5:20 AM

I have two different Silverlight UserControls imported with MEF from two different xaps. The UserControls are simply an Image on a Canvas. Both UserControls have the image marked as 'Resource'. The images are different but their names are the same (key point). I'm not quite sure what's going on behind the scenes of the MEF import but both images seem to end up in the same AppDomain. After the composition when I stick the UserControls on a Canvas, each is an instance of the class it should be, but they both show the same image.

Obviously if the image file names are unique across all xaps I import I have no problem but I don't like that solution. Is there a better one?

EDIT:

Forgot to mention that: 1) I'm using relative URIs to the images. (e.g. "Images/Image1.png"). Not sure if my problem is the URI not being specific enough. 2) I'm using two DeploymentCatalogs + an AggregateCatalog if that makes a difference.

Apr 14, 2010 at 4:39 PM

It turns out using an assembly-qualified URI (/AssemblyShortName;component/Images/Image1.png vs Images/Image1.png) fixes my problem.