kformeck
kformeck

Reputation: 1933

Issues Embedding JPG Images into a WPF Application

No matter what I do, I cannot get my jpeg image to appear when running the application. I need to be able to deploy this application with all the images present.

I have an image in my resources called BinOpticsLogo. It is linked to an image here

C:\Users\kyle.formeck\Documents\Visual Studio 2008\Projects\AOILibrary\VisualInspectionConsole\VisualInspectionConsole_currentFasterDBUploads\WaferTracker\binopticslogo_full.jpg.

The properties of this image are:

Build Action = Resource
Copy To Output Directory = Copy Always

XAML Code referencing this image:

    <Image 
        Source="binopticslogo_full.jpg"
        Height="23"/>

In my resources, the BinOpticsLogo resources Persistence property is set to Embedded in .resx

I see the image properly in the designer, but when I run the application, I never see the image.

Any help will be greatly appreciated!

-Kyle

Upvotes: 0

Views: 327

Answers (1)

kformeck
kformeck

Reputation: 1933

Solved it!

Here is the updated XAML code that made it all work:

    <Image
        Height="23">
        <Image.Source>
            <ImageSource>/WaferTracker;component/Resources/BinOpticsLogo.jpg</ImageSource>
        </Image.Source>
    </Image>

Upvotes: 1

Related Questions