title: WPF textboxes are too big
body: <p>I have a WPF page with some data entry TextBoxes on it and they look much bigger than the font needs.  What determines the height of the textbox?  is there a way to squish them up?</p>
  
  <p>The textbox gets bigger and smaller according to the font size it displays (so I don't want to set the height property directly if I can help it.</p>
  
  <p>Here's an example of what I mean...</p>
  
  <pre><code>&lt;Page
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt;
    &lt;Page.Resources&gt;
      &lt;Style x:Key="LabelStyle" TargetType="Label"&gt;
        &lt;Setter Property="HorizontalAlignment" Value="Right"/&gt;
        &lt;Setter Property="VerticalAlignment" Value="Center"/&gt;
        &lt;Setter Property="VerticalContentAlignment" Value="Center"/&gt;
      &lt;/Style&gt;
  
      &lt;Style x:Key="TextBoxStyle" TargetType="TextBox"&gt;
        &lt;Setter Property="HorizontalAlignment" Value="Left"/&gt;
        &lt;Setter Property="VerticalAlignment" Value="Center"/&gt;
        &lt;Setter Property="VerticalContentAlignment" Value="Center"/&gt;
      &lt;/Style&gt;
  
    &lt;/Page.Resources&gt;
    &lt;StackPanel&gt;
      &lt;WrapPanel&gt;
        &lt;Label Style="{StaticResource LabelStyle}" Content="{Binding ActualHeight, RelativeSource={RelativeSource Self}}"/&gt;
        &lt;TextBox Style="{StaticResource TextBoxStyle}" Text="{Binding ActualHeight, RelativeSource={RelativeSource Self}, Mode=OneWay}"/&gt;
      &lt;/WrapPanel&gt;
      &lt;WrapPanel&gt;
        &lt;Label Style="{StaticResource LabelStyle}" Content="{Binding ActualHeight, RelativeSource={RelativeSource Self}}"/&gt;
        &lt;TextBox Style="{StaticResource TextBoxStyle}" Text="{Binding ActualHeight, RelativeSource={RelativeSource Self}, Mode=OneWay}"/&gt;
      &lt;/WrapPanel&gt;
    &lt;/StackPanel&gt;
  &lt;/Page&gt;
  </code></pre>
  
  <p>If you look at the size you will see the label is a little bigger than the textbox.  Changing the VerticalAlignment on the textbox to Top makes it the same size.  As an interim measure I just set a margin on the label to -2.</p>