title: WPF TreeView Binding
body: <p>I've got a class with Parent and Children properties.</p>
  
  <p><a href="http://img148.imageshack.us/img148/6802/edmxxe8.gif">ADO.NET Entity Framework Hierarchical Page Class http://img148.imageshack.us/img148/6802/edmxxe8.gif</a></p>
  
  <p>I want to display this hierarchy in a WPF treeview.</p>
  
  <p>Here's my XAML...</p>
  
  <pre><code>&lt;TreeView Margin="12" Name="TreeViewPages" ItemsSource="{Binding}"&gt;
      &lt;TreeView.ItemTemplate&gt;
          &lt;HierarchicalDataTemplate ItemsSource="{Binding Children}"&gt;
              &lt;TextBlock Text="{Binding Path=ShortTitle}" /&gt;
          &lt;/HierarchicalDataTemplate&gt;
      &lt;/TreeView.ItemTemplate&gt;
  &lt;/TreeView&gt;
  </code></pre>
  
  <p>And my VB code...</p>
  
  <pre>
  Dim db As New PageEntities
  Dim t = From p In db.Page.Include("Children") _
          Where p.Parent Is Nothing _
          Select p
  TreeViewPages.ItemsSource = t
  </pre>
  
  <p>But then I only get a tree two levels deep.  What do I need to do to get this working?</p>