Textbox - text centering

noname picture noname · Aug 15, 2010 · Viewed 58.7k times · Source

Is there any simple way to center a text in textbox? I was looking for some built-in functions, but I found nothing.

Answer

Thomas Levesque picture Thomas Levesque · Aug 15, 2010

Set the TextAlignment property to Center:

<TextBox Width="200"
         Text="Hello world !"
         TextAlignment="Center"/>