TextBox justify text

Primož Kralj picture Primož Kralj · Jun 11, 2012 · Viewed 9k times · Source

Is it possible to Justify (not center) text in TextBox? I am aware of

txt.TextAlign = HorizontalAlignment.Left;

for example, but is it possible to justify it left AND right?

Answer

General Grey picture General Grey · Jun 11, 2012

I think what the OP is going for is this http://en.wikipedia.org/wiki/Justification_(typesetting) then look under this heading

Justified (flush left and right)

I am afraid there is no easy way to do this. You would need to do as Damith suggested and create a custom control for it, and even that wont be easy, because every time you enter a letter, your text spacing will shrink and it will look funny. If you are wanting to do a read-only textbox, that could be done, but if you want the user to add text to it... I think you would need a real good reason to take the time to implement this.