title: Bind Object to WPF TreeView
body: <p>I would like to know how to bind a custom data type to a <code>TreeView</code>.</p>
  
  <p>The data type is basically an arraylist of objects that contain other arraylists.  Access would look something like this:</p>
  
  <pre><code>foreach (DeviceGroup dg in system.deviceGroups)
      {
          foreach (DeviceType dt in dg.deviceTypes)
          {
              foreach (DeviceInstance di in dt.deviceInstances)
              {
  
              }
          }
      }
  </code></pre>
  
  <p>I would like the <code>TreeView</code> to look something like this:</p>
  
  <p>DeviceGroup1</p>
  
  <pre><code> --&gt; DeviceType1
        --DeviceInstance1
        --DeviceInstance2
   --&gt; DeviceType2
        --DeviceInstance1
  </code></pre>
  
  <p>DeviceGroup2</p>
  
  <pre><code> --&gt; DeviceType1
        --DeviceInstance1
   --&gt; DeviceType2
  </code></pre>