title: Bind Icon depending on Enum in WPF Treeview
body: <p>I have at treeview TextBox, and I want convert my Enum:</p>
  
  <pre><code>&lt;TextBlock TextAlignment="Justify" VerticalAlignment="Center" Text="{Binding Path=AcceptationStatusGlobalFlag}" /&gt;
  
  public enum AcceptationStatusGlobalFlag
      {
          NotReady = 0,
          Ready = 1,
          AcceptedByAdmin=2
      }
  </code></pre>
  
  <p>to Icons. There will be 3 icons, let say ready.jpg, notready.jpg and AcceptedByAdmin.jpg</p>
  
  <p>Country and Region has pool AcceptationStatusGlobalFlag and on both I want to display this enum/Icon</p>
  
  <p>
      
          
              </p>
  
  <pre><code>            &lt;TreeView Name="structureTree" SelectedItemChanged="structureTree_SelectedItemChanged" Grid.Row="0" Grid.Column="0" ItemsSource="{Binding}" Height="413" ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollViewer.HorizontalScrollBarVisibility="Visible" Width="Auto" PreviewMouseRightButtonUp="structureTree_PreviewMouseRightButtonUp" FontFamily="Verdana" FontSize="12"&gt;
                  &lt;TreeView.Resources&gt;
                      &lt;HierarchicalDataTemplate DataType="{x:Type ServiceMy:Country}" 
                                ItemsSource="{Binding Path=ListOfRegions}"&gt;
                          &lt;StackPanel Orientation="Horizontal"&gt;
                              &lt;TextBlock TextAlignment="Justify" VerticalAlignment="Center" Text="{Binding Path=Name}"/&gt;
                  &lt;TextBlock TextAlignment="Justify" VerticalAlignment="Center" Text=" H:"/&gt;
                  &lt;TextBlock TextAlignment="Justify" VerticalAlignment="Center" Text="{Binding Path=NumberOfHotels}"/&gt;
                  &lt;TextBlock TextAlignment="Justify" VerticalAlignment="Center" Text=" "/&gt;
                              &lt;TextBlock TextAlignment="Justify" VerticalAlignment="Center" Text=" FG:"/&gt;
                              &lt;TextBlock TextAlignment="Justify" VerticalAlignment="Center" Text="{Binding Path=AcceptationStatusGlobalFlag}" /&gt;
                  &lt;!--&lt;Button Name="BTNAddRegion" Height="20" Content="+" Click="BTNAddRegion_Click"&gt;&lt;/Button&gt;--&gt;
              &lt;/StackPanel&gt;
                      &lt;/HierarchicalDataTemplate&gt;
                      &lt;HierarchicalDataTemplate DataType="{x:Type ServiceMy:Region}" 
                                ItemsSource="{Binding Path=ListOfProvinces}"&gt;
                          &lt;StackPanel Orientation="Horizontal"&gt;
                              &lt;TextBlock TextAlignment="Justify" VerticalAlignment="Center" Text="{Binding Path=Name}"/&gt;
                  &lt;TextBlock TextAlignment="Justify" VerticalAlignment="Center" Text=" H:"/&gt;
                  &lt;TextBlock TextAlignment="Justify" VerticalAlignment="Center" Text="{Binding Path=NumberOfHotels}"/&gt;
                  &lt;TextBlock TextAlignment="Justify" VerticalAlignment="Center" Text=" "/&gt;
                  &lt;!--&lt;Button Name="BTNAddProvince" Height="20" Content="+" Click="BTNAddProvince_Click"&gt;&lt;/Button&gt;--&gt;
              &lt;/StackPanel&gt;
  
  
                      &lt;/DataTemplate&gt;
  
                  &lt;/TreeView.Resources&gt;
              &lt;/TreeView&gt;
          &lt;/GroupBox&gt;
  
      &lt;/StackPanel&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>