Here’s a useful tip for you budding WPF aficionados out there. If there is any chance that the text in a textblock may become truncated (the databound text may not fit or the window may be resized), assuming you don’t want the text to wrap (where you would use the TextWrapping attribute), add the TextTrimming attribute. Your options are None (no ellipse – default), WordEllipse (an ellipse is inserted after the last word that fits) or CharacterEllipse (an ellipse is inserted after the last character that fits).
Example from MSDN
<TextBlock
Name="myTextBlock"
Margin="20" Background="LightGoldenrodYellow"
TextTrimming="CharacterEllipse" TextWrapping="NoWrap"
FontSize="14"
>
One<LineBreak/>
two two<LineBreak/>
Three Three Three<LineBreak/>
four four four four<LineBreak/>
Five Five Five Five Five<LineBreak/>
six six six six six six<LineBreak/>
Seven Seven Seven Seven Seven Seven Seven
TextBlock>
Results in
.png)
Hope it helps.