Show image resource in WPF window defined in class library

I saw this topic: WPF image resources and applied the information there. But my situation looks a little more complicated:

  • Assembly Ais a class library
    • contains Dialog.xaml
      • this is a WPF window
    • contains Images/i.gif
  • Build Bis a WPF Application
    • shows Dialog.xaml

In my dialog box, I tried to specify the image as follows:

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

and

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

both work, but only in the designer !

Then I added two and two together to get:

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

but it shows the same symptoms:

As soon as I launch the application, the images do not seem to be found. I do not know for sure, since I do not have an error message. They just don't appear.

Any ideas?

+3
1

, "" ,

://:,,/YourAssembly.Name /Images/PlusGreen.png

+10

Source: https://habr.com/ru/post/1778169/


All Articles