title: WPF TreeView and Virtualization(UI & Data)
body: <p>I have a hierarchical structure such as the following :</p>
  
  <pre><code> class User
    {
       public List&lt;Contract&gt; Contracts{get;set;}
    }
  
    class Contract
    {
       public List&lt;Group&gt; Groups{get;set;}
    }
  
    class Group
    {
       public List&lt;Article&gt; Articles{get;set;}
    }
  
    class Article
    {
        public string Name{get;set;}
        public string Id{get;set;}
    }
  </code></pre>
  
  <p>every user has some contracts associated to him, every contract has some groups associated to him, and every group has some articles.</p>
  
  <p>I represent this visually using a TreeView (with checkboxes such as in <a href="http://www.codeproject.com/KB/WPF/TreeViewWithCheckBoxes.aspx" rel="nofollow">http://www.codeproject.com/KB/WPF/TreeViewWithCheckBoxes.aspx</a>) in WPF :</p>
  
  <p><strong>(every user clicked on displays this structure in a TreeView)</strong> :</p>
  
  <pre><code>&gt;Contract1
    &gt;Group1
      &gt;Article1
      &gt;Article2
      &gt;Article3
      &gt;Article4
      ...
    &gt;Group2
    &gt;Group3
    ------------
    Add Button
    Remove Button
    -------------
  </code></pre>
  
  <p>Using the precedent screen, the user can Add further Articles or Contracts or Groups to his account just by checking on them and clicking Add button or remove them by clicking Remove Button.</p>
  
  <p>the problem is that there are tens of thousands of articles in every Group and I don't want to bring them all in memory at once, for it would slow things down.</p>
  
  <p>Can you think of any better way of handling this ? </p>