title: Create Multiple Items Using ItemsControl
body: <p>I am a novice when it comes to WPF so I don't even know if what I am trying to do is possible. I have been reading about ItemsControl to create numerous instances of an item. All of the examples I have seen, only allow you to create X number of items for one "type" like the below example:</p>
  
  <pre><code>ItemsControl ItemsSource="{Binding MyCollection}"&gt;
      &lt;ItemsControl.ItemTemplate&gt;
         &lt;DataTemplate&gt;
             &lt;Button Content="{Binding }" /&gt;
         &lt;/DataTemplate&gt;
      &lt;/ItemsControl.ItemTemplate&gt;
  &lt;/ItemsControl&gt;
  </code></pre>
  
  <p>which creates a button for every item in the ItemSource.</p>
  
  <p>I want to be able to create items of various types like a TextBox, Button, and ComboBox using ItemsControl any time I click a button. So when I click samp_Btn1 I want a new TextBox and button to appear beneath the one's I already have displayed.</p>
  
  <p>I tried:</p>
  
  <pre><code> ItemsControl&gt;
      &lt;ItemsControl.ItemTemplate&gt;
         &lt;DataTemplate&gt;
             &lt;Button Name="test_Btn"
                Width="50"
                Height="50"/&gt;
             &lt;TextBox Name="test_TextBox" Width="50" Height="50" /&gt;
         &lt;/DataTemplate&gt;
      &lt;/ItemsControl.ItemTemplate&gt;
  &lt;/ItemsControl&gt;
  </code></pre>
  
  <p>and then a function that just created a new ItemControl</p>
  
  <pre><code>        private void createNewItem()
      {
          ItemsControl test = new ItemsControl();
      }
  </code></pre>
  
  <p>but I keep getting an error saying the PropertyVisual Tree is set more than once. Is this the right way to go about things or do I need to create an ItemControl for the TextBox and Button separately? </p>