title: Textbox or Datepicker in DataTemplate. Based on the data type I want one, but not both
body: <p>I have a datatemplate for my listbox:</p>
  
  
  
  <pre class="lang-xaml prettyprint-override"><code>&lt;DataTemplate x:Key="CheckBoxTextBoxItemTemplate"&gt;
      &lt;StackPanel Orientation="Horizontal"&gt;
          &lt;CheckBox Focusable="False" IsChecked="{Binding IsChecked}" VerticalAlignment="Center"/&gt;
          &lt;ContentPresenter Content="{Binding Name, Mode=OneTime}" Margin="2,0" Width="140" VerticalAlignment="Center"/&gt;
          &lt;TextBox Text="{Binding FieldData}" Margin="2,0" Width="200" Visibility="{Binding FieldDataVisible}"/&gt;
      &lt;/StackPanel&gt;
  &lt;/DataTemplate&gt;
  </code></pre>
  
  <p>However the items in the list that the listbox is bound to are not all String types. Some are DateTime and a few are Integers. I would like to have a datetimepicker displayed instead of a textbox for the DateTime types. How can I make this happen.</p>
  
  <p>To clarify some points the list is populated at runtime using reflection so I don't know which fields are what types ahead of time.</p>