There are times when the amount of text to be displayed in a TextBlock just doesn’t fit and only the initial text that fits is displayed. Usually the user can detect this because they realize, based on the content, that something got chopped off but that isn’t always the case. For example, the following text could fit in a fairly narrow TextBlock:
“Never comment your code”
Unfortunately the rest of the sample sentence ,“Never comment your code if you want to keep your job”, doesn’t display and the user has no way of logically knowing they’re missing anything.
This is where the TextTrimming property comes in handy. Setting the TextTrimming property to WordEllipis will cause a “…” to appear at the end of the text.
XAML: <TextBlock Name="textBlock1" TextTrimming="WordEllipsis" />
Code: textBlock1.TextTrimming = TextTrimming.WordEllipsis;
The result is “Never comment your …” which visually indicates there is more text available than meets the eye.
Have a day.