title: TreeView not showing icons for all nodes
body: <p>Can someone please help me figure out what's wrong with my template? I modified the default template as I wanted to show different icons for my tree nodes depending upon each node's <code>Tag</code> property value. It only shows icons for the root node and its immediate first child. All the rest of the nodes display without icon:</p>
  
  <pre><code>&lt;Style TargetType="TreeViewItem" BasedOn="{StaticResource {x:Type TreeViewItem}}"&gt;
      &lt;Setter Property="Template"&gt;
          &lt;Setter.Value&gt;
              &lt;ControlTemplate TargetType="TreeViewItem"&gt;
                  &lt;StackPanel&gt;
                      &lt;Grid Margin="0"&gt;
                          &lt;Grid.ColumnDefinitions&gt;
                              &lt;ColumnDefinition Width="Auto" MinWidth="16" /&gt;
                              &lt;ColumnDefinition Width="Auto" MinWidth="20" /&gt;
                              &lt;ColumnDefinition Width="*" /&gt;
                              &lt;ColumnDefinition Width="Auto" MinWidth="20" /&gt;
                              &lt;ColumnDefinition Width="Auto" MinWidth="20" /&gt;
                          &lt;/Grid.ColumnDefinitions&gt;
                          &lt;Grid.RowDefinitions&gt;
                              &lt;RowDefinition Height="Auto" /&gt;
                              &lt;RowDefinition /&gt;
                          &lt;/Grid.RowDefinitions&gt;
  
                          &lt;ToggleButton IsChecked="{Binding Path=IsExpanded, RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press" Name="Expander"&gt;
                              &lt;ToggleButton.Style&gt;
                                  &lt;Style TargetType="ToggleButton"&gt;
                                      &lt;Setter Property="UIElement.Focusable" Value="false" /&gt;
                                      &lt;Setter Property="FrameworkElement.Width" Value="16" /&gt;
                                      &lt;Setter Property="FrameworkElement.Height" Value="16" /&gt;
                                      &lt;Setter Property="Control.Template"&gt;
                                          &lt;Setter.Value&gt;
                                              &lt;ControlTemplate TargetType="ToggleButton"&gt;
                                                  &lt;Border Padding="5,5,5,5" Background="#00FFFFFF" Width="16" Height="16"&gt;
                                                      &lt;Path Fill="#00FFFFFF" Stroke="#FF989898" Name="ExpandPath"&gt;
                                                          &lt;Path.Data&gt;
                                                              &lt;PathGeometry Figures="M0,0L0,6L6,0z" /&gt;
                                                          &lt;/Path.Data&gt;
                                                          &lt;Path.RenderTransform&gt;
                                                              &lt;RotateTransform Angle="135" CenterX="3" CenterY="3" /&gt;
                                                          &lt;/Path.RenderTransform&gt;
                                                      &lt;/Path&gt;
                                                  &lt;/Border&gt;
                                                  &lt;ControlTemplate.Triggers&gt;
                                                      &lt;Trigger Property="UIElement.IsMouseOver" Value="True"&gt;
                                                          &lt;Setter TargetName="ExpandPath" Property="Shape.Stroke" Value="#FF1BBBFA" /&gt;
                                                          &lt;Setter TargetName="ExpandPath" Property="Shape.Fill" Value="#00FFFFFF" /&gt;
                                                      &lt;/Trigger&gt;
                                                      &lt;Trigger Property="ToggleButton.IsChecked" Value="True"&gt;
                                                          &lt;Setter TargetName="ExpandPath" Property="UIElement.RenderTransform"&gt;
                                                              &lt;Setter.Value&gt;
                                                                  &lt;RotateTransform Angle="180" CenterX="3" CenterY="3" /&gt;
                                                              &lt;/Setter.Value&gt;
                                                          &lt;/Setter&gt;
                                                          &lt;Setter TargetName="ExpandPath" Property="Shape.Fill" Value="#FF595959" /&gt;
                                                          &lt;Setter TargetName="ExpandPath" Property="Shape.Stroke" Value="#FF262626" /&gt;
                                                      &lt;/Trigger&gt;
                                                  &lt;/ControlTemplate.Triggers&gt;
                                              &lt;/ControlTemplate&gt;
                                          &lt;/Setter.Value&gt;
                                      &lt;/Setter&gt;
                                  &lt;/Style&gt;
                              &lt;/ToggleButton.Style&gt;
                          &lt;/ToggleButton&gt;
  
                          &lt;ContentPresenter Grid.Column="1"&gt;
                              &lt;ContentPresenter.Style&gt;
                                  &lt;Style TargetType="{x:Type ContentPresenter}"&gt;
                                      &lt;Style.Triggers&gt;
                                          &lt;DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type TreeViewItem}}, Path=Tag}" Value="2"&gt;
                                              &lt;Setter Property="Content"&gt;
                                                  &lt;Setter.Value&gt;
                                                      &lt;Ellipse Width="6" Height="6" Fill="Black" Stroke="Black" /&gt;
                                                  &lt;/Setter.Value&gt;
                                              &lt;/Setter&gt;
                                          &lt;/DataTrigger&gt;
                                          &lt;DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type TreeViewItem}}, Path=Tag}" Value="1"&gt;
                                              &lt;Setter Property="Content"&gt;
                                                  &lt;Setter.Value&gt;
                                                      &lt;Image Width="16" Height="16" Stretch="Uniform" Grid.Column="1" Source="..\Resources\1432599157_layers.png" /&gt;
                                                  &lt;/Setter.Value&gt;
                                              &lt;/Setter&gt;
                                          &lt;/DataTrigger&gt;                                        
                                      &lt;/Style.Triggers&gt;
                                  &lt;/Style&gt;
                              &lt;/ContentPresenter.Style&gt;
                          &lt;/ContentPresenter&gt;
  
                          &lt;Border x:Name="Bd" HorizontalAlignment="Stretch" BorderThickness="{TemplateBinding Border.BorderThickness}" BorderBrush="{TemplateBinding Border.BorderBrush}" 
                                  Padding="{TemplateBinding Control.Padding}" SnapsToDevicePixels="True" Grid.Column="2" Grid.ColumnSpan="3"&gt;
                              &lt;ContentPresenter x:Name="PART_Header"
                                  Content="{TemplateBinding HeaderedContentControl.Header}"
                                  ContentTemplate="{TemplateBinding HeaderedContentControl.HeaderTemplate}"
                                  ContentStringFormat="{TemplateBinding HeaderedItemsControl.HeaderStringFormat}"
                                  ContentTemplateSelector="{TemplateBinding HeaderedItemsControl.HeaderTemplateSelector}"
                                  ContentSource="Header"
                                  HorizontalAlignment="Left"
                                  SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" /&gt;
                          &lt;/Border&gt;
                          &lt;ItemsPresenter HorizontalAlignment="Stretch" x:Name="ItemsHost" Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="3" /&gt;
                      &lt;/Grid&gt;
                  &lt;/StackPanel&gt;
                  &lt;ControlTemplate.Triggers&gt;
                      &lt;Trigger Property="TreeViewItem.IsExpanded" Value="False"&gt;
                          &lt;Setter TargetName="ItemsHost" Property="UIElement.Visibility" Value="Collapsed" /&gt;
                      &lt;/Trigger&gt;
                      &lt;Trigger Property="ItemsControl.HasItems" Value="False"&gt;
                          &lt;Setter TargetName="Expander" Property="UIElement.Visibility" Value="Hidden" /&gt;
                      &lt;/Trigger&gt;
                      &lt;Trigger Property="TreeViewItem.IsSelected" Value="True"&gt;
                          &lt;Setter TargetName="Bd" Property="Panel.Background" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" /&gt;
                          &lt;Setter Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" /&gt;
                      &lt;/Trigger&gt;
                      &lt;MultiTrigger&gt;
                          &lt;MultiTrigger.Conditions&gt;
                              &lt;Condition Property="TreeViewItem.IsSelected" Value="True" /&gt;
                              &lt;Condition Property="Selector.IsSelectionActive" Value="False" /&gt;
                          &lt;/MultiTrigger.Conditions&gt;
                          &lt;Setter TargetName="Bd" Property="Panel.Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" /&gt;
                          &lt;Setter Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" /&gt;
                      &lt;/MultiTrigger&gt;
                      &lt;Trigger Property="UIElement.IsEnabled" Value="False"&gt;
                          &lt;Setter Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" /&gt;
                      &lt;/Trigger&gt;
                  &lt;/ControlTemplate.Triggers&gt;
              &lt;/ControlTemplate&gt;
          &lt;/Setter.Value&gt;
      &lt;/Setter&gt;
  &lt;/Style&gt;
  </code></pre>