TextBlock.TextWrapping - 如何使文本换行以使线条居中对齐? [英] TextBlock.TextWrapping - how to make the text wrap so that the lines are center-aligned?
问题描述
在 Windows Phone 7 应用程序中,当我在网格中放置一个 TextBlock 并将它的 HorizontalAlignment
设置为Center
"和它的 TextWrapping
到Wrap
",为什么溢出容器宽度并放在下一行的文本,与否则居中对齐的块的左侧对齐?
In a Windows Phone 7 application, when I place a TextBlock in the grid and set its HorizontalAlignment
to "Center
" and its TextWrapping
to "Wrap
", why does the text that overflows the width of the container and is placed on the next line, align with the left side of the otherwise center-aligned block?
有没有办法设置文本换行,使文本块中的所有文本都居中对齐?
Is there any way to setup text wrapping so that all of the text in the text block is center-aligned?
推荐答案
您可能缺少TextAlignment:
<TextBlock TextAlignment="Center" />
HorizontalAlignment 将使 TextBlock 居中,TextAlignment 将对齐 inside 文本块中的文本.
HorizontalAlignment will center the TextBlock, TextAlignment will align the text inside the textblock.
这篇关于TextBlock.TextWrapping - 如何使文本换行以使线条居中对齐?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!