How to show image in Shell from an external assembly in WPF using PRISM 5 and MEF

May 8, 2014 at 7:26 PM
Edited May 8, 2014 at 7:27 PM
i have a composite application that loads dynamically an external assembly using prism 5 and MEF, the module contains an image, how can i show this image on my shell?
The module is loaded dynamically by using DirectoryCatalog and it's not referenced on the start-up project.
i tried the following but it doesn't work:
<Image Source="pack://application:,,,/MyDllFileName;component/Images/icon.png" />
<Image Source="/MyDllFileName;component/Images/icon.png" />
how can i solve this problem please?
May 9, 2014 at 3:59 PM

I have tried to reproduce your problem, but both approaches you mentioned worked successfully on my solution.
For Runtime execution, you would not need any other implementation rather than the Image control definition in the Shell or UserControl View. If you would like to see the image in DesignTime instead, you would need to additionally reference the external assembly on the specific project.

Anyway, regarding your problem I would suggest you to verify the external assembly location:

  • Assembly file should be placed on the Debug or Release folder where the solution builds and runs.
  • The path of the image inside the assembly would be relative to the root assembly. So if you have the Image folder placed on the root of the project assembly, the source path would be as you correctly described.
if this did not help you, it would be helpful if you could explain what in particular would not work.

Gabriel Ostrowsky
Marked as answer by cYounes on 5/12/2014 at 7:01 AM
May 12, 2014 at 3:01 PM
Thanks a lot GOstrowsky

The problem was in my the property AssemblyName, it returns the assembly name with the extension .dll
I solved the problem by using the function Path.GetFileNameWithoutExtension()

Thank you.