#845 – Display Ellipsis in TextBlock to Indicate that Content Doesn’t Fit

By default, when the text in a TextBlock does not fit the available space, the text is simply clipped against the boundaries of the available space.

849-001

You can, however, use the TextTrimming property to cause an ellipsis (three dots) to be displayed when the TextBlock contains more text than can be displayed.

Possible values for TextTrimming area:

  • None – no ellipsis, text is clipped  (the default)
  • CharacterEllipsis – display as many characters as possible, followed by an ellipsis
  • WordEllipsis – display as many words as possible, followed by an ellipsis
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <TextBlock Text="{StaticResource someText}"
                    TextWrapping="Wrap" TextTrimming="CharacterEllipsis"
                    Margin="10"/>
        <StackPanel Grid.Row="1" Background="AliceBlue"/>
    </Grid>

849-002

About Sean
Software developer in the Twin Cities area, passionate about .NET technologies. Equally passionate about my own personal projects related to family history and preservation of family stories and photos.

One Response to #845 – Display Ellipsis in TextBlock to Indicate that Content Doesn’t Fit

  1. Pingback: Dew Drop – June 21, 2013 (#1,570) | Alvin Ashcraft's Morning Dew

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: