title: how to dynamically create controls for GridView DataTemplate in WPF?
body: <p>I have a GridView control:</p>
  
  <pre><code>       &lt;GridView&gt;
              &lt;GridViewColumn Header="Name" Width="500"&gt;
                  &lt;GridViewColumn.CellTemplate&gt;
                      &lt;DataTemplate&gt;
                          &lt;StackPanel Orientation="Horizontal"&gt;
  
                          &lt;/StackPanel&gt;
                      &lt;/DataTemplate&gt;
                  &lt;/GridViewColumn.CellTemplate&gt;
              &lt;/GridViewColumn&gt;
              &lt;GridViewColumn DisplayMemberBinding="{Binding TypeName}" Header="Type" Width="100" /&gt;
          &lt;/GridView&gt;
  </code></pre>
  
  <p>for the first column("name"), I would like to have a mechanism that when every record is binded, will be a way(e.g. event), so that I can dynamically add controls to the StackPanel.</p>
  
  <p>for example, my data has a column called AnimalType, if it is a cat, I will add an image to the StackPanel; if it is a cow, I will put a media element to play a movie; if it is a dog, I will put a hyper link, etc.</p>
  
  <p>How can I do that?</p>