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
,为什么文本会超出容器的宽度并被放置在下一行中,是否与否则居中对齐的块的左侧对齐?
是否可以通过任何方式设置文本换行,以便文本中的所有文本
您可能缺少 TextAlignment :
< TextBlock TextAlignment = Center />
HorizontalAlignment将使TextBlock居中,TextAlignment将使文本 inside 对准文本块
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?
You are probably missing TextAlignment:
<TextBlock TextAlignment="Center" />
HorizontalAlignment will center the TextBlock, TextAlignment will align the text inside the textblock.
这篇关于TextBlock.TextWrapping-如何使文本自动换行,以使行居中对齐?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!