title: DockPanel - Stretch control to fill remaining space in respect to it's siblings Visibility
body: <p>The following snippet produces this result:</p>
  
  <pre><code>&lt;DockPanel Width="240"&gt;
      &lt;ComboBox HorizontalAlignment="Stretch"&gt;
          &lt;ComboBoxItem Content="A" /&gt;
          &lt;ComboBoxItem Content="B" /&gt;
          &lt;ComboBoxItem Content="C" /&gt;
      &lt;/ComboBox&gt;
  &lt;/DockPanel&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Tzb3C.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Tzb3C.png" alt="enter image description here"></a></p>
  
  <p>As we can see, the <code>ComboBox</code> fills the entire <code>DockPanel</code> width nicely, as it's supposed to be.
  If we add the following <code>StackPanel</code> right after the <code>ComboBox</code>, we would have this:</p>
  
  <pre><code>&lt;StackPanel Orientation="Horizontal" Width="120" Visibility="Visible" Background="Aqua"&gt;
      &lt;TextBox Width="60" /&gt;
      &lt;TextBox Width="60" /&gt;
  &lt;/StackPanel&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/QwxW3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QwxW3.png" alt="enter image description here"></a></p>
  
  <p>We've just got into the first problem: shouldn't the <code>ComboBox</code> fill the other 120 pixels of the <code>DockPanel</code>, due to it's <code>HorizontalAlignment=Stretch</code> and since the <code>StackPanel</code> uses the other 120?</p>
  
  <p>Least, if we turn our <code>StackPanel.Visibility</code> into <code>Hidden/Collapsed</code>, we would have this:</p>
  
  <p><a href="https://i.stack.imgur.com/e53ZT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/e53ZT.png" alt="enter image description here"></a></p>
  
  <p>How can I make the <code>ComboBox</code> to fill the entire <code>DockPanel.Width</code> <strong>HORIZONTALLY</strong>, just like the first image, when the <code>StackPanel.Visibility</code> is <code>Hidden/Collapsed</code>?</p>
  
  <p>All the controls must be horizontally aligned and a <code>DockPanel</code> isn't mandatory to achieve this.</p>