title: Simple Nested TreeView Xaml structure?
body: <p>I am trying to build a WPF <code>TreeView</code> with three layers. <code>CountryReportTitle</code> is a string property and <code>ArticleCategoryTitlesList</code> is a collection, both exposed from my <code>ViewModel</code>. There is no class hierarchy defined. This is the structure I'm looking for:</p>
  
  <p><img src="https://i.stack.imgur.com/nVXuS.png" alt="enter image description here"></p>
  
  <p>This is my attempted Xaml but I'm getting an exception in the Xaml at runtime:</p>
  
  <pre><code>{"Item has already been added. Key in dictionary: 'DataTemplateKey(ISESApp.ViewModels.ReportViewModel)'  Key being added: 'DataTemplateKey(ISESApp.ViewModels.ReportViewModel)'"}
  </code></pre>
  
  <p>Xaml:</p>
  
  <pre><code>       &lt;TreeView ItemsSource="{Binding CountryReportTitle}"&gt;
                      &lt;TreeView ItemsSource="{Binding CountryReportTitle}"&gt;
                          &lt;TreeView.Resources&gt;
                              &lt;HierarchicalDataTemplate  DataType="{x:Type local:ReportViewModel}"
                                  ItemsSource="{Binding ArticleCategoryTitlesList}"&gt;
                                  &lt;TextBlock Text="{Binding CategoryTitle}" /&gt;
                              &lt;/HierarchicalDataTemplate&gt;
                              &lt;HierarchicalDataTemplate  DataType="{x:Type local:ReportViewModel}"
                                  ItemsSource="{Binding ArticleCatagoryTypesList}"&gt;
                                  &lt;TextBlock Text="{Binding ArticleTitle}" /&gt;
                              &lt;/HierarchicalDataTemplate&gt;
                              &lt;DataTemplate  DataType="{x:Type local:ReportViewModel}"&gt;
                                  &lt;TextBlock Text="{Binding ArticleTitle}" /&gt;
                              &lt;/DataTemplate&gt;
                          &lt;/TreeView.Resources&gt;
                      &lt;/TreeView&gt;
                  &lt;/TreeView&gt;
  </code></pre>
  
  <p>Local: is a namespace to my ViewModel:</p>
  
  <pre><code>xmlns:local="clr-namespace:MyApp.ViewModels"
  </code></pre>
  
  <p>What am I doing wrong, what is the best approach for this problem?</p>