简体   繁体   English

Viewbox 中的文本块不是多行

[英]Textblock in Viewbox not multiline

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>

Thank you in advance!先感谢您!

尝试在 TextBlock 上设置宽度(或最大宽度)。

将这些属性添加到您的文本块 TextWrapping="Wrap" - 包装 IsHyphenationEnabled="True" - 用连字符打破这个词

In this case, here is another solution: take this class and make your own LimitedViewbox version, which will have some LowerStretchLimit property.在这种情况下,这是另一种解决方案:采用此类并制作您自己的 LimitedViewbox 版本,该版本将具有一些 LowerStretchLimit 属性。 I think it should work.我认为它应该工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM