0

I use a two lines TextBlock. And I hope to wrap words in it, while each word's height should match the height of TextBlock Height/2.

For example, the words may be "Hello Tom! Hello Jack! Hello Rose! Hello John!" When they are in the TextBlock, they should look like below:

Hello Tom! Hello Jack!
Hello Rose! Hello John!
Tom Xue
  • 3,169
  • 7
  • 40
  • 77

1 Answers1

0
<Style TargetType=“TextBlock”>
    <Setter Property=“TextWrapping” Value=“WholeWord” />
    <!— Determine your TextBlock height and set half height here —>
    <Setter Property=“LineHeight” Value=“50” />
    <Setter Property=“MaxLines” Value”2” />
    <!— Determine the width that gives you two likes of text to display how you’d like it —>
    <Setter Property=“Width” Value=“100” />
    <Setter Property=“TextAllignment” Value=“Left” />

<Style/>

Or follow the methods described here

Newline in string attribute

visc
  • 4,794
  • 6
  • 32
  • 58