title: WPF: Adding an image to a ListBox ItemTemplate
body: <p>I am creating a WPF app with a list box that I am binding to project names. As a decorative element, I want to place a small icon next to each item in the list, similar to the way Outlook does in its Personal Folders list. For starters, I am going to use the same image for all items in the list.</p>
  
  <p>Here is the markup that I've got so far (I'll move it to a resource dictionary after it's working):</p>
  
  <pre><code>&lt;ListBox.Resources&gt;
      &lt;ImageBrush x:Key="ProjectIcon" ImageSource="Images/project.png" /&gt;
  &lt;/ListBox.Resources&gt;
  &lt;ListBox.ItemTemplate&gt;
      &lt;DataTemplate&gt;
          &lt;StackPanel Orientation="Horizontal"&gt;
              &lt;Image Source="{StaticResource ProjectIcon}"/&gt;
              &lt;TextBlock Text="{Binding Path=Name}" /&gt;
          &lt;/StackPanel&gt;
      &lt;/DataTemplate&gt;
  &lt;/ListBox.ItemTemplate&gt;
  </code></pre>
  
  <p>I've got an error in the image resource, but I'm not sure how to fix it. Any suggestions? Thanks.</p>