TextBlock TextWrapping not wrapping

前端 未结 4 542
野趣味
野趣味 2020-12-10 00:48

When I place a TextBlock inside of a Horizontally Aligned StackPanel it does not wrap. I realize that this is because the available width of the StackPanel is PositiveInfini

4条回答
  •  不思量自难忘°
    2020-12-10 01:18

    It's because you're using Horizontal orientation on the StackPanel. That means that the StackPanel is giving full width to each child control, and then laying them out horizontally - even if that means exceeding its bounded/visible width. Because there's nothing to constrain the width of the TextBlock, it doesn't wrap.

    If you switch to Vertical orientation then the wrapping works, but I'm guessing there's a reason for you specifying otherwise. Can you show what layout you're trying to achieve?

提交回复
热议问题