title: wpf: setting of ItemsContainerStyle rewrites all custom style of custom TreeViewControl
body: <p>I developed custom <code>TreeView</code> (call it <code>MyTree</code>). In <code>ResourceDictionary</code> in <code>General.xaml</code> of this custom control I defined style for <code>TreeViewItem</code> where set control template, that I needed to display every item. First I create special ControlTemplate:</p>
  
  <pre><code>&lt;ControlTemplate TargetType="{x:Type TreeViewItem}" x:Key="MyTreeViewItem"&gt;
  .........
  &lt;/ControlTemplate&gt;
  </code></pre>
  
  <p>Then I use it in custom style for <code>MyTree</code>:</p>
  
  <pre><code>&lt;Style TargetType="{x:Type local:MyTree}"&gt;
      &lt;Setter Property="Template"&gt;
          &lt;Setter.Value&gt;
              &lt;ControlTemplate TargetType="{x:Type local:MyTree}"&gt;
                  &lt;ControlTemplate.Resources&gt;
                      &lt;Style TargetType="{x:Type TreeViewItem}"&gt;
                          &lt;Setter Property="Template" Value="{StaticResource MyTreeViewItem}" /&gt;
                      &lt;/Style&gt;
                  &lt;/ControlTemplate.Resources&gt;
                  ..........
                  &lt;ItemsPresenter /&gt;
                  ..........
               &lt;/ControlTemplate&gt;
          &lt;/Setter.Value&gt;
      &lt;/Setter&gt;
  &lt;/Style&gt;
  </code></pre>
  
  <p>Everything works, while i use my control like:</p>
  
  <pre><code>&lt;local:MyTree&gt;
       &lt;local:MyTree.ItemTemplate&gt;
              &lt;HierarchicalDataTemplate ItemsSource="{Binding DependentSuites}"/&gt;
       &lt;/local:MyTree.ItemTemplate&gt;
       ..........other property specific for MyTree control.............
  &lt;/local:MyTree&gt;
  enter code here
  </code></pre>
  
  <p>And it does wrong when I try to add style for my TreeViewItem. For example, following code</p>
  
  <pre><code>&lt;local:MyTree&gt;
       &lt;local:MyTree.ItemTemplate&gt;
              &lt;HierarchicalDataTemplate ItemsSource="{Binding DependentSuites}"/&gt;
       &lt;/local:MyTree.ItemTemplate&gt;
       ..........other property specific for MyTree control.............
       &lt;local:MultiColumnTreeView.Resources&gt;
              &lt;Style TargetType="TreeViewItem"
                  &lt;Setter Property="Background" Value="Red"/&gt;
              &lt;/Style&gt;
          &lt;/local:MultiColumnTreeView.Resources&gt;
  &lt;/local:MyTree&gt; 
  </code></pre>
  
  <p>cause wpf resets my custom template and start using default style for TreeViewItem. The same situation takes a place if I set any value for ItemsContainerStyle. Other words, any style modification rewrite my custom style in General.xaml. Why does it happen, and how to avoid that, combining all styles.</p>