TextBlock.TextWrapping - 如何使文本换行以使线条居中对齐? [英] TextBlock.TextWrapping - how to make the text wrap so that the lines are center-aligned?

查看:20
本文介绍了TextBlock.TextWrapping - 如何使文本换行以使线条居中对齐?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Windows Phone 7 应用程序中,当我在网格中放置一个 TextBlock 并将它的 Horizo​​ntalAlignment 设置为Center"和它的 TextWrappingWrap",为什么溢出容器宽度并放在下一行的文本,与否则居中对齐的块的左侧对齐?

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" />

Horizo​​ntalAlignment 将使 TextBlock 居中,TextAlignment 将对齐 inside 文本块中的文本.

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

这篇关于TextBlock.TextWrapping - 如何使文本换行以使线条居中对齐?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆