title: How to add icons to wpf treeview using dockpanel and binding?
body: <p>I have a treeview inside of a dockpanel and all of the elements of the treeview are inside HierarchicalDataTemplates. Here is the code:</p>
  
  <pre><code>&lt;DockPanel Margin="10,10,0,0" VerticalAlignment="Stretch" Grid.Row="0" Grid.RowSpan="5" Grid.Column="0"&gt;
          &lt;DockPanel.Resources&gt;
  
              &lt;src:TreeViewFilter x:Key="MyList" /&gt;
  
              &lt;HierarchicalDataTemplate DataType="{x:Type src:TreeViewParent}" ItemsSource="{Binding Path=OrderAttributes}"&gt;
                  &lt;TextBlock Text="{Binding Path=Name}" FontSize="24"/&gt;
              &lt;/HierarchicalDataTemplate&gt;
  
              &lt;HierarchicalDataTemplate DataType="{x:Type src:OrderAttribute}" ItemsSource="{Binding Path=OrderAttributes}"&gt;
                  &lt;TextBlock Text="{Binding Path=NameAndCount}" FontSize="16"/&gt;
              &lt;/HierarchicalDataTemplate&gt;
  
          &lt;/DockPanel.Resources&gt;
          &lt;TreeView Name="treeView1" BorderThickness="2" ItemsSource="{Binding Source={StaticResource MyList}, UpdateSourceTrigger=PropertyChanged}" TreeViewItem.Selected="treeViewFilter"/&gt;
      &lt;/DockPanel&gt;
  </code></pre>
  
  <p>As you can see, the DockPanel wraps around the TreeView. The icons I am trying to add would be in the second HierarchicalDataTemplate which binds to a string and displays as a textbox. Depending on the name of the "NameAndCount", I would choose an icon to be displayed next to it on the left.</p>
  
  <p>Any ideas on a solution for my example? Or do I need to think about using different templates like StackPanel?</p>