title: ComboBox in my WPF DataGrid won't display any items
body: <p>I have a WPF user control that contains a DataGrid. This DG contains several columns including a ComboBox for states. The list of states is populated and stored as a property in my ViewModel.</p>
  
  <p>I am trying to bind the StateList Property to the ItemsSource of my Combobox but when I run the form and try to edit the DG, the combobox does not contain any values, the combobox is empty.</p>
  
  <p>Here is the XAML for the usercontrol.</p>
  
  <pre><code>&lt;UserControl x:Class="myproject.View.ucContactView"
           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" 
           mc:Ignorable="d" d:DesignHeight="475" d:DesignWidth="977"&gt;
  &lt;UserControl.Resources&gt;
      &lt;ResourceDictionary Source="/Templates/MyResourceDictionary.xaml"/&gt;
  &lt;/UserControl.Resources&gt;
  &lt;Grid DataContext="{Binding ViewModel}"&gt;
      &lt;DataGrid AutoGenerateColumns="False" ItemsSource="{Binding AddressCollectionViewSource.View}"&gt;
          &lt;DataGridTemplateColumn Header="State" Width="160"&gt;
              &lt;DataGridTemplateColumn.CellTemplate&gt;
                  &lt;DataTemplate&gt;
                      &lt;TextBlock Text="{Binding StateDescription}"/&gt;
                  &lt;/DataTemplate&gt;
              &lt;/DataGridTemplateColumn.CellTemplate&gt;
              &lt;DataGridTemplateColumn.CellEditingTemplate&gt;
                  &lt;DataTemplate&gt;
                      &lt;StackPanel Orientation="Horizontal"&gt;
                          &lt;ComboBox Name="cboState"
                                    SelectedValuePath="StateKey"
                                    ItemTemplate="{StaticResource dtStateTemplate}"
                                    ItemsSource="{Binding StateList}" 
                                    SelectedItem="{Binding StateKey, Mode=TwoWay}"
                                    Width="100" /&gt;
                      &lt;/StackPanel&gt;
                  &lt;/DataTemplate&gt;
              &lt;/DataGridTemplateColumn.CellEditingTemplate&gt;
          &lt;/DataGridTemplateColumn&gt;
      &lt;/DataGrid&gt;
  &lt;/Grid&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p>The odd thing is that if I create another combobox on this usercontrol with the exact same combobox, this combobox works as expected.</p>
  
  <pre><code>&lt;!-- this works as long as it's not in the DG --&gt;
  &lt;StackPanel Height="126" HorizontalAlignment="Left" Margin="766,275,0,0" Name="stackPanel1" VerticalAlignment="Top" Width="200" &gt;
      &lt;ComboBox Name="cboState2"
            SelectedValuePath="StateKey"
            ItemTemplate="{StaticResource dtStateTemplate}"
            ItemsSource="{Binding StateList}" 
            SelectedItem="{Binding StateKey, Mode=TwoWay}"
            Width="100" /&gt;
  &lt;/StackPanel&gt;
  </code></pre>
  
  <p>Why won't the combobox in the DG display the values from the StateList property? Any why does the separate combobox work properly?</p>