In my post "Easily create XAML objects from Clipart" I was exporting the image as a Canvas. Which works quite well if you want to use the XAML inline. But this can make your XAML quite busy. A better way might be to export your images from Expression Design as a Resource Dictionary. This way the image XAML is in a separate file.
The way you reference this separate resource dictionary is as easy as 1 - 2 - 3:
1. Add it to your solution.
2. In your Application.XAML file add a reference your resource dictionary....you can see in mine i am referencing two exported images. Since these files are merged and Expression design names them the same thing (Metafile) you will need to rename one of them.
<Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="stove1.xaml"/> <ResourceDictionary Source="doctor.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources>
You can also reference these resource dictionaries directly in your page or window
The syntax is same as you can see below
<Page.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="stove1.xaml"> </ResourceDictionary> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Page.Resources>
3. To display this referenced resource dictionary you use the syntax: "{StaticResource Metafile}" where Metafile is the name of the resource you exported in your dictionary.
In my case below i am using it to fill a rectangle
<Rectangle Fill="{StaticResource Metafile}" Width="65" Height="65" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Bottom" />