title: WPF: How to make controls stretch in a StackPanel?
body: <p>A Slider and some other controls won't stretch to fill available space when placed in a StackPanel; instead the width is always MinWidth (or about 10 pixels if MinWidth is not set). How do I make it stretch (the equivalent of Anchor.Left|Anchor.Right in WinForms)? Example:</p>
  
  <pre><code>&lt;StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal"&gt;
      &lt;Slider Value="14" SmallChange="0.5" Maximum="100" Minimum="4" 
              x:Name="FontSize" MinWidth="30" LargeChange="2" 
              TickFrequency="10" TickPlacement="TopLeft" 
              HorizontalAlignment="Stretch"/&gt;
      &lt;TextBlock Margin="8" Text="{Binding ElementName=FontSize, Path=Value}" 
                 VerticalAlignment="Center"/&gt;
  &lt;/StackPanel&gt;
  </code></pre>