title: How to create ListBox.Itemtemplate,datatemplate programatically in Windows Phone 7
body: <p>I find that there is some item templates, data templates and binding in the .xaml  file for listbox. Is there any way to create it in code behind?</p>
  
  <p>Is there any way to create data templates programataically?</p>
  
  <p><strong>this is the XAML CODE,BUT I need in code behind using c# not in XAML,because
  am working in dynamic list box creation with adding itemtemplatem,datatemplate</strong></p>
  
  <pre><code>&lt;ListBox Height="520" HorizontalAlignment="Left" Margin="0,6,0,0" Name="lstimge" VerticalAlignment="Top" Width="450" &gt;
                  &lt;ListBox.ItemTemplate&gt;
                      &lt;DataTemplate&gt;
                          &lt;StackPanel Orientation="Horizontal"&gt;
                              &lt;Image  Source="{Binding Image}" Width="150" Stretch="Uniform" HorizontalAlignment="Center" /&gt;
                              &lt;TextBlock Text="{Binding FileName}" TextWrapping="Wrap" /&gt;
                          &lt;/StackPanel&gt;
                      &lt;/DataTemplate&gt;
                  &lt;/ListBox.ItemTemplate&gt;
              &lt;/ListBox&gt;
  </code></pre>
  
  <p>Kindly give the solution </p>
  
  <p>Thanks,
  Ashok</p>