title: How can I vertically align a TextBox inside a StackPanel?
body: <p>In the following XAML, the word "Test" centers <strong>horizontally</strong> but not vertically.</p>
  
  <p><strong>How can I get it to center vertically?</strong></p>
  
  <pre><code>&lt;Window x:Class="TestVerticalAlign2343.Window1"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          WindowStartupLocation="CenterScreen"
      Title="Window1" Height="768" Width="1024"&gt;
      &lt;DockPanel LastChildFill="True"&gt;
          &lt;Slider x:Name="TheSlider"
                  DockPanel.Dock="Left"
                  Orientation="Vertical"
                  HorizontalAlignment="Center"
                  HorizontalContentAlignment="Center"
                  Minimum="0"
                  Maximum="10"
                  Cursor="Hand"
                  Value="{Binding CurrentSliderValue}"
                  IsDirectionReversed="True"
                  IsSnapToTickEnabled="True"
                  Margin="10 10 0 10"/&gt;
          &lt;Border DockPanel.Dock="Right" Background="Beige"
                  Padding="10"
                  Margin="10"
                  CornerRadius="5"&gt;
              &lt;StackPanel Height="700"&gt;
                  &lt;TextBlock
                      Text="Test"
                      HorizontalAlignment="Center"
                      VerticalAlignment="Center"
                      FontSize="200" x:Name="TheNumber"/&gt;
  
              &lt;/StackPanel&gt;
          &lt;/Border&gt;
      &lt;/DockPanel&gt;
  &lt;/Window&gt;
  </code></pre>