title: Create Silverlight controls dynamically for each ItemsControl item
body: <p>I want to bind list of objects each of it has UIType (ie textbox, checkbox, combo etc). And it has object Value property.</p>
  
  <p>I want to bind this list to an ItemControl (ListBox, DataGrid..) where each item will have separate template corresponding to the particular UIType of each object (eg item for combo will have combo in the row and item for checkbox will have checkbox)...</p>
  
  <p>obviously prop Value will be bound to relevant property on each item.</p>
  
  <p>whats the most transparent and not too elaborate way to achieve this?</p>
  
  <p>Silverlight 5.</p>
  
  <p><strong>EDIT: (working code based on the Jacob's solution)</strong></p>
  
  <p>code:</p>
  
  <pre><code>ObservableCollection&lt;UIType&gt; data;
  
  public MainPage()
  {
      InitializeComponent();
  
      data = new ObservableCollection&lt;UIType&gt;() 
      { 
          new UITypeTextBox() { Value = "Value.." }, 
          new UITypeCheckBox(){ Value = true },  
      };
  
      lb.ItemsSource = data;
  }
  
  public class UIType { }
  public class UITypeTextBox  : UIType { public object Value { get; set; }}
  public class UITypeCheckBox : UIType { public object Value { get; set; } }
  </code></pre>
  
  <p>xaml:</p>
  
  <pre><code>&lt;ListBox x:Name="lb"&gt;
      &lt;ListBox.Resources&gt;
          &lt;DataTemplate DataType="local:UITypeTextBox"&gt;
              &lt;TextBox Text="{Binding Value}" /&gt;
          &lt;/DataTemplate&gt;
          &lt;DataTemplate DataType="local:UITypeCheckBox"&gt;
              &lt;CheckBox IsChecked="{Binding Value}" /&gt;
          &lt;/DataTemplate&gt;
      &lt;/ListBox.Resources&gt;
  &lt;/ListBox&gt;
  </code></pre>