Text vertical alignment in WPF TextBlock
问题 How do I assign vertical center alignment to the text inside a TextBlock? I found TextAlignment property but it is for horizontal text alignment. How do I do it for vertical text alignment? 回答1: A Textblock itself can't do vertical alignment The best way to do this that I've found is to put the textblock inside a border, so the border does the alignment for you. <Border BorderBrush="{x:Null}" Height="50"> <TextBlock TextWrapping="Wrap" Text="Some Text" VerticalAlignment="Center"/> </Border>