title: WPF treeview datatemplate
body: <p>Let's say I have something like this:</p>
  
  <pre><code>public class TopicFolder
      {
          #region Constants and Fields
  
          private readonly List&lt;TopicInfo&gt; folderContent;
  
          private readonly List&lt;TopicFolder&gt; subFolders;
  
          #endregion
  
  ...
      }
  </code></pre>
  
  <p>How do I implement a data template for such type? Currently I have:</p>
  
  <pre><code>&lt;HierarchicalDataTemplate DataType="{x:Type local:TopicFolder}" ItemsSource="{Binding SubFolders}" &gt;
              &lt;TextBlock Text="{Binding Name}"/&gt;
          &lt;/HierarchicalDataTemplate&gt;
          &lt;HierarchicalDataTemplate DataType="{x:Type local:TopicInfo}" ItemsSource="{Binding FolderContent}"&gt;
              &lt;TextBlock Text="{Binding TopicName}"/&gt;
          &lt;/HierarchicalDataTemplate&gt;
  </code></pre>
  
  <p>But this does not show any folder content. It seems that second's template DataType should be local:TopicFolder, but this is not allowed by WPF.</p>
  
  <p>Any suggestions? </p>
  
  <p>UPD : TreeView is bound to ObservableCollection&lt;TopicFolder> this way:</p>
  
  <pre><code>ItemsSource="{Binding Path=Folders}"
  </code></pre>
  
  <p>P.S: It is definitely not a private/public/properties problem. I have corresponding public properties for posted fields. No binding errors in output, it is just not showing any FolderContent items.</p>