title: HierarchicalDataTemplate bound to a TreeView does not produce anything
body: <p>I am trying to bind a hierarchical structure to a TreeView using Data Binding, but nothing is displayed in the TreeView. </p>
  
  <p>XAML code in the Control:</p>
  
  <pre><code>&lt;UserControl x:Class="CQViewer.Views.HierarchyView"
               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
               xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
               xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
               xmlns:h="clr-namespace:CQViewer.Hierarchy"
               mc:Ignorable="d" 
               d:DesignHeight="300" d:DesignWidth="300"&gt;
    &lt;Grid&gt;
      &lt;TabControl Margin="5, 0, 5, 5" Grid.Column="0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"&gt;
        &lt;TabItem Header="Repository"&gt;
          &lt;TreeView Margin="5, 5, 5, 5" HorizontalAlignment="Stretch" ItemsSource="{Binding Path=Nodes}"&gt;
            &lt;TreeView.Resources&gt;
              &lt;HierarchicalDataTemplate DataType="{x:Type h:HierarchyNode}"
                                        ItemsSource="{Binding ChildNodes}"&gt;
                &lt;TextBlock Text="{Binding Name}" /&gt;
              &lt;/HierarchicalDataTemplate&gt;
            &lt;/TreeView.Resources&gt;
          &lt;/TreeView&gt;
        &lt;/TabItem&gt;
        &lt;TabItem Header="Libraries"&gt;
          &lt;ListBox Margin="5, 5, 5, 5" HorizontalAlignment="Stretch" /&gt;
        &lt;/TabItem&gt;
      &lt;/TabControl&gt;
    &lt;/Grid&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p>The class that I am using:</p>
  
  <pre><code>using System.Collections.Generic;
  
  namespace CQViewer.Hierarchy
    {
    class HierarchyNode
      {
      #region Fields
      private IList&lt;HierarchyNode&gt; childNodes_;
      #endregion
  
      #region Construction/Deconstruction/Initialisation
      /// &lt;summary&gt;
      /// Constructor
      /// &lt;/summary&gt;
      public HierarchyNode (string Name)
        {
        this.Name = Name;
        childNodes_ = new List&lt;HierarchyNode&gt; ();
        }
      #endregion
  
      #region Properties
      public string Name { get; set; }
      public IList&lt;HierarchyNode&gt; ChildNodes
        {
        get { return childNodes_; }
        set { childNodes_ = value; }
        }
      #endregion
      }
    }
  </code></pre>
  
  <p>What I want to do is populate the TreeView using the ChildNodes in the HierarchyNode objects using the HierarchicalDataTemplate, while displaying a TextBlock for the name of the current object. The root HierarchyNode is created in the constructor of the ViewModel. Data Binding in this UserControl works, since binding a List&lt;> to the ListBox works fine.</p>
  
  <p>What is wrong with what I am doing, and why it is not working?</p>
  
  <p>EDIT: The ViewModel used for the View</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  
  using CQViewer.Hierarchy;
  
  namespace CQViewer.ViewModels
    {
    class HierarchyViewModel : ViewModelBase
      {
      #region Fields
  
      #endregion
  
      #region Construction/Deconstruction/Initialisation
      /// &lt;summary&gt;
      /// Constructor
      /// &lt;/summary&gt;
      public HierarchyViewModel ()
        {
        Nodes = new HierarchyNode ("Test1");
        HierarchyNode Node2 = new HierarchyNode ("TestX");
        Node2.ChildNodes.Add (new HierarchyNode ("TestY"));
  
        Nodes.ChildNodes.Add (Node2);
        Nodes.ChildNodes.Add (new HierarchyNode ("Test3"));
        }
      #endregion
  
      #region Properties
      public HierarchyNode Nodes { get; set; }
      #endregion
  
      #region Public Access Interface
      /// &lt;summary&gt;
      /// Creates/Recreates the hierarchy
      /// &lt;/summary&gt;
      public void InitializeHierarchy ()
        {
        // TODO Clear the tree view
        }
  
      /// &lt;summary&gt;
      /// Gets the folder currently selected in the tree view hierarchy
      /// &lt;/summary&gt;
      public string GetCurrentlySelected ()
        {
        return "$/";
        }
      #endregion
  
      #region Private Functions
  
      #endregion
      }
    }
  </code></pre>