Please see my comment to the question: of course this is possible and easy, but you need to clarify what is your image.
If this is a bitmap, you usually use the class:
System.Windows.Media.Imaging.BitmapImage
:
http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.bitmapimage.aspx[
^].
Look at the end of the MSDN article referenced above and find the sample showing loading an image from file. You can also load it from a resource embedded in your assembly's executable module or from any other kind of stream. See also the parent class
System.Windows.Media.Imaging.BitmapSource
and other derived classes: you might need further processing of a image or something else; besides, this is the core or WPF image processing, very good to know:
http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.bitmapsource.aspx[
^],
http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.bitmapsource.aspx (inheritance hierarchy)[
^].
You can also use vector graphics. One of the way is using XAML files which content is the instance of some WPF
Canvas (
System.Windows.Controls.Canvas
):
http://msdn.microsoft.com/en-us/library/system.windows.controls.canvas.aspx[
^].
To load it, you would need to use the class
System.Windows.Markup.XamlReader
:
http://msdn.microsoft.com/en-us/library/system.windows.markup.xamlreader.aspx[
^].
Using it would look like this:
Canvas image = (Canvas)XamlReader.Load();
This approach is very convenient, because the user can easily supply such a XAML image using a number of vector graphics editors, notably Inkscape:
http://en.wikipedia.org/wiki/Inkscape[
^],
http://inkscape.org/[
^].
It has export to XAML (but make sure it renders properly, because XAML has a bit less expressing capabilities compared to SVG, advanced features like fussiness cannot be used).
I think vector graphics has a lot of benefits over bitmaps (scaling without loss of quality, low memory footprint independent of scale and quality at bigger sizes), so a WPF application can be built without any bitmaps at all, excluding the application icon and window title bar icons.
—SA