title: Having trouble with ItemContainerStyle on a Treeview
body: <p>I have the following XML being set on my treeview:</p>
  
  <pre><code>&lt;Root Value="YES"&gt;
   &lt;Child Name="Test"&gt;
   &lt;Sibling Data="Yes"&gt;
    &lt;Last UserData="1"/&gt;
   &lt;/Sibling&gt;
   &lt;Sibling Data="No"/&gt;
   &lt;/Child&gt;
   &lt;Child Name="Test2"/&gt;
  &lt;/Root&gt;
  </code></pre>
  
  <p>and then I have set the following code in my window:  </p>
  
  <pre><code>&lt;Window.Resources&gt;
      &lt;XmlDataProvider x:Key="dataProvider" XPath="Root" Source="C:\XML.xml" /&gt;
  
      &lt;HierarchicalDataTemplate DataType="Root" ItemsSource="{Binding XPath=*}"&gt;
        &lt;TextBlock Text="{Binding XPath=@Value}" /&gt;
  
        &lt;HierarchicalDataTemplate.ItemContainerStyle&gt;
          &lt;Style TargetType="{x:Type TreeViewItem}"&gt;
            &lt;Setter Property="Template"&gt;
              &lt;Setter.Value&gt;
                &lt;ControlTemplate&gt;
                  &lt;Border Background="Blue"&gt;
                    &lt;ContentPresenter/&gt;
                  &lt;/Border&gt;
                &lt;/ControlTemplate&gt;
              &lt;/Setter.Value&gt;
            &lt;/Setter&gt;
          &lt;/Style&gt;
        &lt;/HierarchicalDataTemplate.ItemContainerStyle&gt;
      &lt;/HierarchicalDataTemplate&gt;
  
      &lt;HierarchicalDataTemplate DataType="Child" ItemsSource="{Binding XPath=*}"&gt;
        &lt;TextBlock Text="{Binding XPath=@Name}" /&gt;
      &lt;/HierarchicalDataTemplate&gt;
  
      &lt;HierarchicalDataTemplate DataType="Sibling" ItemsSource="{Binding XPath=*}"&gt;
        &lt;TextBlock Text="{Binding XPath=@Data}" /&gt;
      &lt;/HierarchicalDataTemplate&gt;
    &lt;/Window.Resources&gt;
  
    &lt;Grid&gt;
      &lt;TreeView Margin="12" x:Name="trv"
           ItemsSource="{Binding Source={StaticResource dataProvider}}" /&gt;
    &lt;/Grid&gt;
  </code></pre>
  
  <p>I would like to have a border control wrap around all the subitems for every node as in this image:</p>
  
  <p><a href="http://www.hardcodet.net/uploads/2008/03/tree-dialogik.png" rel="nofollow noreferrer">http://www.hardcodet.net/uploads/2008/03/tree-dialogik.png</a></p>
  
  <p>In other words, you'll notice in the image I've linked to, the parent node <strong>dialogik.Memory</strong> has a dark gray border that goes around it and around its children. That's the effect I want to achieve.</p>
  
  <p>What do I need to change in my code to have it work correctly ???</p>
  
  <p>Thanks !!</p>