It is possible to make the TextBox center its text vertically. However, that does require you to reapply its ControlTemplate.
To do this:
- Copy the Style and the ControlTemplate from the TextBox Styles and Templates page on MSDN to a suitable
<UserControl.Resources>
element. (This ControlTemplate is actually for a validation tooltip; the ControlTemplate we'll change is within the Style.)
- Find the
ScrollViewer
element within the Style for the TextBox, and add a VerticalAlignment="Center"
property to it.
Alternatively, you could add the property
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
to the ScrollViewer. This should allow you to set the vertical alignment of the contents of your TextBoxes using the VerticalContentAlignment property.
You can follow much the same approach if you wish to change the horizontal alignment of a TextBox's content as well.