title: Extending A ListBox with an ItemTemplate
body: <p>I need to extend a ListBox with a custom ItemTemplate but when I run my code the ItemTemplate does not get applied?</p>
  
  <pre><code>    &lt;ListBox x:Class="ExtendedCheckedListbox"
                   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                   xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                   xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                   xmlns:local="clr-namespace:ExtListBoxPOC"
                   mc:Ignorable="d" 
                   d:DesignHeight="450" d:DesignWidth="800"&gt;
  
          &lt;ListBox.ItemTemplate&gt;
              &lt;DataTemplate&gt;
                      &lt;CheckBox Content="{Binding Description}" VerticalAlignment="Stretch" VerticalContentAlignment="Center" /&gt;
              &lt;/DataTemplate&gt;
          &lt;/ListBox.ItemTemplate&gt;
  
      &lt;/ListBox&gt;
  
  
  private YesNoModel YesNo = new YesNoModel();
  
  {
      DataContext = YesNo;
      cbl.ItemsSource = YesNo;
  
  }
  </code></pre>
  
  <p>My main Window XAML which uses the control called cbl which has the ItemsSource set in code behind:</p>
  
  <pre><code>&lt;Window x:Class="MainWindow"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
          xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
          xmlns:local="clr-namespace:ExtListBoxPOC"
          mc:Ignorable="d"
          Title="MainWindow" Height="450" Width="800"&gt;
      &lt;Grid&gt;
          &lt;local:ExtendedCheckedListbox x:Name="cbl" HorizontalAlignment="Left" Height="300" Margin="10" VerticalAlignment="Top" Width="300"/&gt;
      &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>The Model class is this:</p>
  
  <pre><code>public class YesNoModel
  {
      public string Description { get; set; }
      public int Value { get; set; }
  }
  </code></pre>
  
  <p>And I am adding items here:</p>
  
  <pre><code>{
      YesNo.Add(new YesNoModel() { Description = "Yes", Value = 1 });
      YesNo.Add(new YesNoModel() { Description = "No", Value = 2 });
      YesNo.Add(new YesNoModel() { Description = "N/A", Value = 3 });
  }
  </code></pre>
  
  <p>Code behind the ExtendedCheckedListbox View:</p>
  
  <pre><code>public class ExtendedCheckedListbox : ListBox
  {
  }
  </code></pre>