Stara wersja programu https://drive.google.com/open?id=0B7E799YMGCWTUjh4cWl5YktjWjQ pozwala na to, by ikonka zależała od pola Tag dzięki konwerterowi. Kod C# nie stanowi problemu, gorzej z xaml.
Tam mamy :
<TreeView Name="treeView" Grid.Column="0" AllowDrop="True">
<TreeView.Resources>
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<StackPanel Orientation="Horizontal" >
<Image Name="img" Width="16" Height="16" Stretch="Fill"
Source="{Binding RelativeSource=
{RelativeSource Mode=FindAncestor,AncestorType={x:Type TreeViewItem}},
Path=Tag, Converter={StaticResource TagImageConwerter}}"/>
<TextBlock Text="{Binding}" />
</StackPanel>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</TreeView.Resources>
</TreeView>
Nowe, z możliwością Drag&Drop https://drive.google.com/open?id=0B7E799YMGCWTMHpxUHhINlVCNXc, niestety nie potrafiyświetlić:
<TreeView x:Name="treeView1" ItemsSource="{Binding TreeCollection1}"
gong:DragDrop.IsDragSource="True"
gong:DragDrop.IsDropTarget="True" BorderThickness="0 1 1 0"
gong:DragDrop.DragAdornerTemplate="{StaticResource DragAdorner}">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
<StackPanel Orientation="Horizontal" >
<Image Name="img" Width="16" Height="16" Stretch="Fill"
Source="{Binding Path=Tag, Converter={StaticResource TagImageConwerter}}"
/>
<TextBlock Text="{Binding Name}" />
</StackPanel>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
Najpewniej jest błąd różnica w "Binding Children", jakoś ścieżki do Tag nie widzi. Jak można by to poprawić? Załączam linki do obu przykładów.