title: Wpf Absolute vs. Relative Pack URIs
body: <p><strong>My question is: Am I reading MSDN wrong OR is MSDN wrong?</strong> I am trying to reference an image <em>Resource</em> via relative URI.</p>
  
  <p>The MSDN page titled <strong>Pack URIs in WPF</strong> clearly states that:</p>
  
  <p><em>"Resource file in subfolder of local assembly" =</em> "<strong>/Subfolder/ResourceFile.xaml</strong>"</p>
  
  <p>in Table 2: Relative URIs in Markup (here 
  <a href="http://msdn.microsoft.com/en-gb/library/aa970069.aspx" rel="noreferrer">http://msdn.microsoft.com/en-gb/library/aa970069.aspx</a> ).</p>
  
  <p>So, I created new WPF/.NET 4.0 projects in Vs2010 (v10.0.40219.1 SP1Rel) to test.</p>
  
  <pre><code>Startup Project: TryUri
      App.xaml
      MainWindow.xaml
  Custom Ctrl Project: TryUri.CCL
      Icons/folder.png &lt;-- Marked As Resource!
      Views/TestUC.xaml
  </code></pre>
  
  <p>In TestUC.xaml:</p>
  
  <pre><code>&lt;Canvas&gt;
      &lt;Border&gt;
          &lt;Image Source="/Icons/folder.png" Height="Auto" Width="Auto" /&gt;
      &lt;/Border&gt;
  &lt;/Canvas&gt;
  </code></pre>
  
  <p>In MainWindow.xaml:</p>
  
  <pre><code>// xmlns:uc="clr-namespace:TryUri.CCL.Views;assembly=TryUri.CCL"
  
  &lt;uc:TestUC /&gt;
  </code></pre>
  
  <p>Result: <em>The image does not show up!!</em></p>
  
  <p>When I change the path to "../Icons/folder.png" <strong>It does work.</strong></p>
  
  <p>If I copy the Icons/folder.png into the TryUri.CCL/Views/ folder, then "Icons/folder.png" works.</p>
  
  <p>However, I can never get a leading forward slash to work as in "/Icons/folder.png" the way that MSDN states.</p>