Tuesday, October 25, 2016

Newline in a WPF label?

Method 1:

in WPF you can use the value "
" or "
"

For example:

<b><label Content="Lorem&#10;ipsum" /></b>

("10" is the ASCII number for newline)

or

<b><label Content="Lorem&#xA;ipsum" /></b>

("A" is the ASCII number for newline in hex)

Method 2:

<Label><TextBlock>Lorem<LineBreak/>ipsum</TextBlock></Label>

Reference:

http://stackoverflow.com/questions/483802/newline-in-a-wpf-label

No comments: