# .NET and More > WPF, WCF, WF >  [RESOLVED] Display image from embedded resx file.

## Jenner

I'm at it again tearing my hair out trying to figure out WPF and I hit the dumbest of roadblocks that for the life of me, I can't seem to find a straight answer on.

I have 3 images embedded in a resx file.  I can call them in code easily: My.Resources.MyImage1

How on earth do I display them on a WPF form?  I've tried imageboxes but nothing I put in for the "source" property seems to work.  I've tried linking them to the XAML directly, but no go.

One of the goals of this little project is to be 100% self contained in a single .EXE (so it can be emailed and run by anyone on the intranet) so external files aren't a possibility.

----------


## bflosabre91

something like this?



```
    <Image>
         <Image.Source>
               <BitmapImage UriSource="Resources/MyImage.png"></BitmapImage>
          </Image.Source>
     </Image>
```

edit: sorry, didnt realize u said embedded. this prob wont be what ur looking for then.

----------


## chris128

I'm not sure how you would do it with a RESX file (or even how you use a RESX file in WPF) but what I do is just have a folder named Images or Resources or something in my solution explorer and put all images in there, then use an Image element on the form to display them. I do recall it was a nightmare figuring out the correct path style to use for the Image's Source property when I first did it but once you know how to do it its ok. Here's an example:

vb Code:
ImageBox.Source = New BitmapImage(New Uri("..\Resources\myimage.gif", System.UriKind.Relative))

----------


## Jenner

Yea, that's my problem.  I'd like to make this one completely self-contained as a single file.  It's a program that generates a company-standard email signature for Outlook.  This way, I can just put a link to it on our website and our outside sales guys can just download it, run it, and be done with it.  I don't want it to install anywhere or unpackage anything.  

All I'm looking to make is a pop-up form with graphical instructions for how to switch to the new signature in Outlook.  It blows my mind I can't do this easily.   :Frown: 

Why is it stupid problems like this that EVERY TIME I try to use WPF for a project, it ends up un-doable because of some stupid limitation in the framework?!  :Confused:  Last time, it was localization, or the lack-there-of.  I'm really wanting to like WPF but I mean geez!!   :Cry:

----------


## chris128

It will still be a single file... I have never used a RESX file (at least not knowingly) and I have always just had one single EXE that is usable on multiple computers using the method I mentioned in my post.

----------


## bflosabre91

this might help you? 

http://www.codeproject.com/KB/WPF/WP...medium=twitter

----------


## Jenner

Nice find bflosabre91.  I bookmarked that for later review.  

Sorry Chris128, I tried what you said and the images didn't load on the window if the image files weren't in a directory relative to the binary.  In the end, I gave up.  I allowed myself some extra time to try to make this little program but this was taking way too much of it.  I finished the program yesterday, and it's still using WPF (my first permanent WPF program, yay me) but rather than pop up a graphical dialog window with pictures explaining how to go in and configure Outlook, I chose instead to explain that step in my company-wide distribution email.

Marking thread as resolved only because I'm sure somewhere in the link bflosabre91 provided explains how to work with images in resource files in WPF.  It looks pretty extensive.

----------

