Reputation: 149
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!
Upvotes: 2
Views: 1640
Reputation: 488
In this case, here is another solution: take this class and make your own LimitedViewbox version, which will have some LowerStretchLimit property. I think it should work.
Upvotes: 0
Reputation: 2280
Add these properties to your textblock TextWrapping="Wrap" - wrapping IsHyphenationEnabled="True" - breaking the word with hyphen
Upvotes: 0