TextBlock.TextWrapping - how to make the text wrap so that the lines are center-aligned?

℡╲_俬逩灬. 提交于 2019-11-29 16:04:44

问题


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?


回答1:


You are probably missing TextAlignment:

<TextBlock TextAlignment="Center" />

HorizontalAlignment will center the TextBlock, TextAlignment will align the text inside the textblock.



来源:https://stackoverflow.com/questions/3975994/textblock-textwrapping-how-to-make-the-text-wrap-so-that-the-lines-are-center

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!