title: How can I set the WPF BitmapImage UriSource property to a relative path?
body: <p>I'm loading an image in WPF by using the BitmapImage class.  My code works perfectly when I give an absolute path for the UriSource but not when I try and use a relative path.</p>
  
  <p>My XAML is:</p>
  
  <pre><code>&lt;Image Width="50" Name="MemberImage" HorizontalAlignment="Left"&gt;
      &lt;Image.Source&gt;
          &lt;BitmapImage DecodePixelWidth="50" UriSource="questionmark.jpg" /&gt;
      &lt;/Image.Source&gt;
  &lt;/Image&gt;
  </code></pre>
  
  <p>The questionmark.jpg is added to the project with a Build Action of Resource and Copy to Output Directory set to Copy always.  The error I get is "The file [file name] is not part of the project or its 'Build Action' property is not set to 'Resource'".  This works when I use an absolute path for the UriSource but that obviously won't do.</p>
  
  <p>How should I be defining my UriSource in the XAML?</p>