5

I have seen this thread: WPF image resources and applied the information there. But my situation seems a bit more tricky:

  • Assembly A is a class library
    • contains Dialog.xaml
      • this is a WPF window
    • contains Images/i.gif
  • Assembly B is a WPF application
    • shows Dialog.xaml

In my dialog, I have tried specifying the image in the following ways:

<Image Source="/Images/i.gif"/>

and

<Image Source="pack://application:,,,/Images/i.gif"/>

both work, but only in the designer!

Next, I added two and two together to yield:

<Image Source="pack://application:,,,A;;content/Images/i.gif"/>

but this shows the same symptoms:

As soon as I start the application, the images seem to be not found. I don't know for sure, since I get no error message. They just don't show up.

Any ideas?

Community
  • 1
  • 1
Daren Thomas
  • 67,947
  • 40
  • 154
  • 200

1 Answers1

12

You appear to be missing the required word "Component" form the beginning of your path, e.g.

pack://application:,,,/YourAssembly.Name;Component/Images/PlusGreen.png

Tim Lloyd
  • 37,954
  • 10
  • 100
  • 130