<TreeView.Resources>
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TreeViewItem}">
<StackPanel Orientation="Horizontal" Background="BurlyWood">
<Image Height="16" Width="16"
Source="/WpfApplication27;component/Images/Forward.png"></Image>
<Label Content="{TemplateBinding Header}"></Label>
</StackPanel>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<StackPanel HorizontalAlignment="Center"
IsItemsHost="True" Margin="4,6" Orientation="Vertical"/>
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</TreeView.Resources>