title: TreeView WPF Binding Hierarchical
body: <p>My problem is that I don't know how to Bind the two List's CModul_I_O(Inputs,outputs) from CModul. 
  I tried alot of ways with HierarchicalDataTemplate and datatemplates but I always can bind only one of this 2 lists. It also shows only the list of the first CModul.</p>
  
  <p>I need a TreeView which looks like this</p>
  
  <pre><code>    -Modul1
          -Inputs
              input1
              input2
              input3
          -outputs
              output1
              output2
              output3
      -Modul2
          -Inputs
              input1
              input2
              input3
          -outputs
              output1
              output2
              output3
  </code></pre>
  
  <p>My 2 Data class</p>
  
  <pre><code>public class CModul
  {
      protected string sName, sKlasse;
      protected List&lt;CModul_I_O&gt; lInputs,lOutputs;
  
      public CModul()
      {
          sName = "";
          sKlasse = "";
          lInputs = new List&lt;CModul_I_O&gt;();
          lOutputs = new List&lt;CModul_I_O&gt;();
      }
  
      public string Name
      {
          get { return sName; }
          set { sName = value; }
      }
      ...
  
      public List&lt;CModul_I_O&gt; Inputs
      {
          get { return lInputs; }
          set { lInputs = value; }
      }
      public List&lt;CModul_I_O&gt; Outputs
      {
          get { return lOutputs; }
          set { lOutputs = value; }
      }
  }
  
   public class CModul_I_O
  {
      string sName, sVar, sKommentar;
  
      public CModul_I_O()
      {
          sName="";
          sVar="";
          sKommentar="";
      }
  
      public string Name
      {
          get { return sName; }
          set { sName = value; }
      }
      ....
   }
  
   List&lt;CModul&gt; lModule = new List&lt;CModul&gt;();
  </code></pre>
  
  <p>xaml code I have </p>
  
  <pre><code> &lt;Window.Resources&gt;
   &lt;DataTemplate x:Key="module"  DataType="{x:Type local:CModul_I_O}"&gt;
          &lt;Grid&gt;
              &lt;Grid.ColumnDefinitions&gt;
                  &lt;ColumnDefinition Width="150"&gt;&lt;/ColumnDefinition&gt;
                  &lt;ColumnDefinition Width="150"&gt;&lt;/ColumnDefinition&gt;
                  &lt;ColumnDefinition Width="150"&gt;&lt;/ColumnDefinition&gt;
              &lt;/Grid.ColumnDefinitions&gt;
              &lt;TextBox Grid.Column="0" Margin="5" Text="{Binding Path=Name}"&gt;&lt;/TextBox&gt;
              &lt;TextBox Grid.Column="1" Margin="5" Text="{Binding Path=Kommentar}"&gt;&lt;/TextBox&gt;
              &lt;TextBox Grid.Column="1" Margin="5" Text="{Binding Path=Var}"&gt;&lt;/TextBox&gt;
          &lt;/Grid&gt;
      &lt;/DataTemplate&gt;
  
  &lt;/Window.Resources&gt;
  &lt;Grid&gt;
      &lt;TreeView Name="TV_ModulListe" Grid.Row="0"&gt;
          &lt;TreeView.Resources&gt;
              &lt;HierarchicalDataTemplate DataType="{x:Type local:CModul}"  ItemsSource="{Binding Inputs}" ItemTemplate="{StaticResource  module}"&gt;
                  &lt;Grid&gt;
                      &lt;Grid.ColumnDefinitions&gt;
                          &lt;ColumnDefinition Width="150"&gt;&lt;/ColumnDefinition&gt;
                          &lt;ColumnDefinition Width="150"&gt;&lt;/ColumnDefinition&gt;
                      &lt;/Grid.ColumnDefinitions&gt;
                      &lt;TextBox Grid.Column="0" Margin="5" Text="{Binding Path=Name}"&gt;&lt;/TextBox&gt;
                      &lt;TextBox Grid.Column="1" Margin="5" Text="{Binding Path=Klasse}"&gt;&lt;/TextBox&gt;
                  &lt;/Grid&gt;
              &lt;/HierarchicalDataTemplate&gt; 
          &lt;/TreeView.Resources&gt;
      &lt;/TreeView&gt;
  &lt;/Grid&gt;
  </code></pre>