title: Make WPF ComboBoxes fill a whole column width
body: <p>I'm having problems making a <code>ComboBox</code> stretch to fill the whole column width in a <code>GridViewColumn</code>. It should also resize when the column is resized. </p>
  
  <p>In the following example I have a <code>StackPanel</code> with a <code>ComboBox</code> inside. This is set to stretch and will in fact stretch to fill the <code>StackPanel</code> width. </p>
  
  <p>Then I add a <code>ListView</code> with one column, containing a <code>StackPanel</code> with a <code>ComboBox</code>. Both the <code>StackPanel</code> and the <code>ComboBox</code> are set to stretch, but they don't. I use background colors to identify the size of the <code>StackPanel</code>s, and there is no red unless I set a width or add elements to the <code>ComboBox</code> such that it needs more width. </p>
  
  <p>I also tried playing around with the <code>HorizontalContentAlignment</code> property without success. </p>
  
  <pre><code>&lt;StackPanel Height="59" Margin="45,12,38,0" VerticalAlignment="Top" Background="Green"&gt;
      &lt;ComboBox HorizontalAlignment="Stretch" /&gt;
  &lt;/StackPanel&gt;
  
  &lt;ListView x:Name="MyListView" Margin="0,106,0,0"&gt;
      &lt;ListView.View&gt;
          &lt;GridView&gt;
              &lt;GridViewColumn Header="Num" Width="70"&gt;
                  &lt;GridViewColumn.CellTemplate&gt;
                      &lt;DataTemplate&gt;
                          &lt;StackPanel Background="red" Orientation="Horizontal" HorizontalAlignment="Stretch"&gt;
                              &lt;ComboBox HorizontalAlignment="Stretch" /&gt;
                          &lt;/StackPanel&gt;
                      &lt;/DataTemplate&gt;
                  &lt;/GridViewColumn.CellTemplate&gt;
              &lt;/GridViewColumn&gt;
          &lt;/GridView&gt;
      &lt;/ListView.View&gt;
      &lt;ListViewItem&gt;&lt;/ListViewItem&gt;
  &lt;/ListView&gt;
  </code></pre>