#844 – The TextBlock Supports Hyphenation

If a TextBlock is set to wrap text automatically, you can also tell it to automatically hyphenate by setting its IsHyphenationEnabled property to true.

In the example below, the first two blocks of text are left justified, but the second block has hyphenation enabled.

The third block enables hyphenation for a justified block of text.

        <TextBlock Text="{StaticResource someText}"
                   TextWrapping="Wrap"
                   TextAlignment="Left"
                   Margin="10"/>
        <TextBlock Text="{StaticResource someText}"
                   TextWrapping="Wrap"
                   IsHyphenationEnabled="True"
                   TextAlignment="Left"
                   Margin="10"/>
        <TextBlock Text="{StaticResource someText}"
                   TextWrapping="Wrap"
                   TextAlignment="Justify"
                   IsHyphenationEnabled="True"
                   Margin="10"/>

844-001

Advertisements