title: Two different DataTemplate
body: <p>I have two ListBoxs defined in my XAML and one Class MyListItem.
  Now one ListBox should display the name as button and the second ListBox should display the name as a TextBlock.</p>
  
  <p>Here a little example, both ListBoxs behave the same.</p>
  
  <p>MyListItem</p>
  
  <pre><code>public class MyListItem
  {
      private string _name;
      public string Name
      {
          get{return _name;}
          set{_name = value;}
      }
  }
  </code></pre>
  
  <p>XAML</p>
  
  <pre><code>&lt;Window xmlns="https://github.com/avaloniaui"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:local="clr-namespace:DataTemplate.Views.MainWindow"
      xmlns:viewsmodels="clr-namespace:DataTemplate.ViewModels;assembly=DataTemplate"
      xmlns:dt="clr-namespace:DataTemplate;assembly=DataTemplate"
      Title="DataTemplate" Width="700"&gt;
  &lt;Window.DataContext&gt;
    &lt;viewsmodels:MainWindowViewModel /&gt;
  &lt;/Window.DataContext&gt;    
  &lt;Grid ColumnDefinitions="250,250,250"&gt;      
    &lt;ItemsControl Grid.Column="1" Items="{Binding List2}"&gt;
      &lt;ItemsControl.DataTemplates&gt;
        &lt;DataTemplate DataType="{x:Type dt:MyListItem}"&gt;
          &lt;TextBlock Text="{Binding Name}"/&gt;  
        &lt;/DataTemplate&gt;
      &lt;/ItemsControl.DataTemplates&gt;
    &lt;/ItemsControl&gt;
    &lt;ItemsControl Grid.Column="2" Items="{Binding List3}"&gt;
      &lt;ItemsControl.DataTemplates&gt;
        &lt;DataTemplate DataType="{x:Type dt:MyListItem}"&gt;
          &lt;Button Content="{Binding Name}"/&gt;  
        &lt;/DataTemplate&gt;
      &lt;/ItemsControl.DataTemplates&gt;
    &lt;/ItemsControl&gt;
  &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>ViewMode</p>
  
  <pre><code>public class MainWindowViewModel
  {
              public ObservableCollection&lt;MyListItem&gt; List1 { get; set; }
      public ObservableCollection&lt;MyListItem&gt; List2 { get; set; }
      public ObservableCollection&lt;MyListItem&gt; List3 { get; set; }
  
      public MainWindowViewModel()
      {
          List1 = new ObservableCollection&lt;MyListItem&gt;();
          List2 = new ObservableCollection&lt;MyListItem&gt;();
          List3 = new ObservableCollection&lt;MyListItem&gt;();
  
          Random rand = new Random();
  
          for (int i = 0; i &lt; rand.Next(1, 20); i++)
          {
              MyListItem mli = new MyListItem();
              mli.Name = "ListItem" + i;
              List1.Add(mli);
          }
  
          for (int i = 0; i &lt; rand.Next(1, 20); i++)
          {
              MyListItem mli = new MyListItem();
              mli.Name = "ListItem" + i;
              List2.Add(mli);
          }
  
          for (int i = 0; i &lt; rand.Next(1, 20); i++)
          {
              MyListItem mli = new MyListItem();
              mli.Name = "ListItem" + i;
              List3.Add(mli);
          }
      }
  }
  </code></pre>