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

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

问题描述

在Windows Phone 7应用程序中,当我将TextBlock放置在网格中并将其 Horizo​​ntalAlignment 设置为 Center 及其 TextWrapping Wrap ,为什么文本会超出容器的宽度并被放置在下一行中,是否与否则居中对齐的块的左侧对齐?



是否可以通过任何方式设置文本换行,以便文本中的所有文本

解决方案

您可能缺少 TextAlignment

 < TextBlock TextAlignment = Center /> 

Horizo​​ntalAlignment将使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屋!

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