我使用两行TextBlock。我希望将单词包裹在其中,而每个单词的高度
应该与TextBlock Height/2
的高度匹配。
例如,单词可能是"Hello Tom! Hello Jack! Hello Rose! Hello John!"
当它们位于TextBlock中时,它们应如下所示:
Hello Tom! Hello Jack!
Hello Rose! Hello John!
答案 0 :(得分: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/>
或遵循此处描述的方法