c# - How do you retrieve an embedded image from a dll for wpf Image control? - Stack Overflow

PHOTO EMBED

Thu Aug 31 2023 15:01:33 GMT+0000 (Coordinated Universal Time)

Saved by @javicinhio #cs

asm = System.Reflection.Assembly.Load(aName)
string[] manifest = asm.GetManifestResourceNames();

using (UnmanagedMemoryStream stream = (UnmanagedMemoryStream)asm.GetManifestResourceStream(manifest[0]))//The Index of the Image you want to use
{
    using (MemoryStream ms1 = new MemoryStream())
    {
        stream.CopyTo(ms1);
        BitmapImage bmi = new BitmapImage();
        bmi.BeginInit();
        bmi.StreamSource = new MemoryStream(ms1.ToArray());
        bmi.EndInit();
        image1.Source  = bmi; //The name of your Image Control
    }

}
content_copyCOPY

https://stackoverflow.com/questions/14805080/how-do-you-retrieve-an-embedded-image-from-a-dll-for-wpf-image-control