Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display text alignment to top, when WPF text box is a multiline

When i use multiline text box the text/content of text box should align to top, and if it is a single line text box then it text alignment should be default one(Center), i need to set this in text box style, so when ever there is a multiline text box my style will automatically adjust the content accordingly.

like image 809
user1794624 Avatar asked Feb 18 '13 17:02

user1794624


1 Answers

you only need to set VerticalContentAlignment="Top" in your textbox like:

<TextBox     
    TextWrapping="Wrap" 
    AcceptsReturn="True" 
    Text="sample ... "
    VerticalContentAlignment="Top"                                
/>
like image 170
Farzad J Avatar answered Nov 08 '22 20:11

Farzad J