title: How to reference an icon resource file reference in XAML
body: <p>I'm trying to get a button to display an icon in XAML. Initially I wanted to paste a character instead, but vb Express 2008 would not recognise it being a symbol as it is not a regular character. Then I created an icon and tried to set the button image property to reference it, but this does not exist, so more misery. Now I've used the project resources to add the icon file which it has shoved in the project resources directory.</p>
  
  <p>What I want to do is use XAML to display the icon, in this tag:</p>
  
  <pre><code>&lt;Button&gt;
  &lt;Image Source="{StaticResource UpArrow}"/&gt;
  &lt;/Button&gt;
  </code></pre>
  
  <p>I ideally want to have the image in a separate file and reference it by the project. I am a bit confused by the content/resource issue.</p>
  
  <p>I tried to access it using:</p>
  
  <pre><code>&lt;UserControl.Resources&gt;
  &lt;BitmapImage x:Key="UpArrow" _
    UriSource="Resources/_25B2_Triangle__black__up_pointing.ico" /&gt;
  &lt;/UserControl.Resources&gt;
  </code></pre>
  
  <p>I've read some stuff about the pack assembly which is massive and confusing. Surely, putting an icon into the resources file should make it easy to reference using /Resources or similar, instead of the absolute file path, otherwise, what is the point of it?</p>
  
  <p>I am wanting to do it all in XAML rather than code-behind because then this work would all be done by the client, but maybe I am not undestanding when to use code behind. With WPF, there is very little written about what you are trying to do at the large scale and why you would want to do it, apart from MS constant refrain of how 'cool' it is, -which is not very helpful.</p>
  
  <p>Thanks..</p>