title: Collapsed Visibility Within a WPF ComboBoxItem
body: <p>I used a Style setter to stretch out my ComboBoxItem (and button) so that it spans the entire length of the ComboBox like so:</p>
  
  <pre><code>    &lt;ComboBox &gt;
          &lt;ComboBox.Resources&gt;
              &lt;Style TargetType="ComboBoxItem"&gt;
                  &lt;Setter Property="HorizontalContentAlignment" Value="Stretch" /&gt;
              &lt;/Style&gt;
          &lt;/ComboBox.Resources&gt;
          &lt;ComboBoxItem &gt;
              &lt;DockPanel &gt;
                  &lt;Button Content="My Button" /&gt;
              &lt;/DockPanel&gt;
          &lt;/ComboBoxItem&gt;
      &lt;/ComboBox&gt;
  </code></pre>
  
  <p>This works fine.  Now, I add an additional button within the same ComboBoxItem, but have it set to Visibility Collapsed.  </p>
  
  <pre><code>    &lt;ComboBox &gt;
          &lt;ComboBox.Resources&gt;
              &lt;Style TargetType="ComboBoxItem"&gt;
                  &lt;Setter Property="HorizontalContentAlignment" Value="Stretch" /&gt;
              &lt;/Style&gt;
          &lt;/ComboBox.Resources&gt;
          &lt;ComboBoxItem &gt;
              &lt;DockPanel &gt;
                  &lt;Button Content="My Button" /&gt;
                  &lt;Button Content="My Collapsed Button" Visibility="Collapsed" /&gt;
              &lt;/DockPanel&gt;
          &lt;/ComboBoxItem&gt;
      &lt;/ComboBox&gt;
  </code></pre>
  
  <p>Now, the new button is invisible, but I expected my original button to still stretch the entire ComboBox, like it does with the above code.  However, it does not.  Why is this so?  Is there a solution for this?  I am using  DataTriggers to edit the Visibility property.</p>
  
  <p>NOTE: I also get the same thing if I just set HorizontalContentAlignment="Stretch" in the ComboBox.</p>
  
  <p>UPDATE:  Ok, this actually has something to do with the DockPanel.  I changed it to a StackPanel, and it works as desired.  However, I suppose I'm still curious as to why my first button would not stretch the entire DockPanel if the second button is collapsed?</p>