title: WPF TreeView bound to ObservableCollection won't update when adding
body: <p>Have browsed similar answers, but I just can't find the problem.</p>
  
  <p>I'm using MvvmLight, and have bound a WPF TreeView to an ObservableCollection in the ViewModel. 
  The tree shows fine, but if I add members to the ObservableCollection later on, the tree doesn't refresh.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>// the data type that represents a tree node
  public class FurnitureTreeNode : GalaSoft.MvvmLight.ViewModelBase
  {
      public string Name { get; private set; }
      public object Data { get; private set; }
      public ObservableCollection&lt;FurnitureTreeNode&gt; ChildNodes { get; set;}
      public Furniture(string Name, ObservableCollection&lt;FurnitureTreeNode&gt; ChildNodes, object Data)
      {
          this.Name = Name;
          this.ChildNodes = ChildNodes;
          this.Data = Data;
      }
  }
  
  public class FurnituresViewModel : GalaSoft.MvvmLight.ViewModelBase
  {
      public ObservableCollection&lt;FurnitureTreeNode&gt; TopFurnitureNodes { get; set; }
      public ObservableCollection&lt;FurnitureTreeNode&gt; ChairNodes { get; set; }
  
      public FurnituresViewModel()
      {
          // initialize the top level furnitures collection
          TopFurnitureNodes = new ObservableCollection&lt;FurnitureTreeNode&gt;();
  
          // add two children
          TopFurnitureNodes.Add(new FurnitureTreeNode("Tables", null, null);
          TopFurnitureNodes.Add(new FurnitureTreeNode("Chairs", null, null);
  
          // add Beds only when they're ready
          BedsManager.ImportsSatisfied += AddBedsNode;
      }
  </code></pre>
  
  <p>The following runs fine, the collection is updated with the Beds node, but it isn't reflected in the TreeView:</p>
  
  <pre><code>    void AddBedsNode( object sender, EventArgs e )
      {
          Task.Run(() =&gt;
          {
              TopFurnitureNodes.Add(new FurnitureTreeNode("Beds", null, null);
          }
          );
      }
  }
  </code></pre>
  
  <p>Here's the XAML:</p>
  
  <pre><code>&lt;TreeView Name="FurnituresTreeView" ItemsSource="{Binding TopFurnitureNodes}"&gt;
      &lt;TreeView.ItemTemplate&gt;
          &lt;HierarchicalDataTemplate ItemsSource="{Binding Path=ChildNodes}" DataType="x:Type FurnitureTreeNode"&gt;
              &lt;TextBlock Text="{Binding Path=Name}" /&gt;
          &lt;/HierarchicalDataTemplate&gt;
      &lt;/TreeView.ItemTemplate&gt;
  &lt;/TreeView&gt;
  </code></pre>
  
  <p>Thank you!</p>