Viewbox 中的文本块不是多行 [英] Textblock in Viewbox not multiline
本文介绍了Viewbox 中的文本块不是多行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在自动调整文本大小方面遇到了一些麻烦.我在某处读到,如果我想实现这一点,我需要将我的 textblock 放在 viewbox 中.问题在于这样文本不会分成多行.例如,非常非常非常长的文本"几乎无法阅读,但简单文本"看起来还不错.
I'm having a bit of a trouble with the autosizing of a text. I read somewhere that if I wanted to achieve that, i need to put my textblock in a viewbox. The problem with that is this way the text isn't split into multiple lines. For example "very very very long text" is almost unreadable, but "simpletext" looks just fine.
<Viewbox Grid.Row="1" Grid.Column="0" Grid.RowSpan="2" Grid.ColumnSpan="4" StretchDirection="DownOnly">
<TextBlock
Text="{Binding FieldName}" VerticalAlignment="Center" HorizontalAlignment="Center"
TextWrapping="Wrap" FontWeight="Bold" FontFamily="Nueva Std" />
</Viewbox>
先谢谢你!
推荐答案
尝试在 TextBlock 上设置宽度(或最大宽度).
Try to set a width (or max width) on the TextBlock.
这篇关于Viewbox 中的文本块不是多行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文