Customizing Text Rendering
Independent of the font, TextBlock enables a number of modifications to the way it renders text. The obvious one is the Foreground property that represents the text color, but here are the others:
→ TextAlignment—Can be set to Left (the default), Center, Right, or Justify.
→ TextTrimming—What should happen to text that doesn’t fit within the TextBlock’s horizontal bounds. Can be set to None (the default), Clip, WordEllipsis, or CharacterEllipsis. None leaves the text alone, Clip truncates it at a pixel level, whereas the other two options place an ellipsis at the end. With WordEllipsis, the ellipsis is placed only at the end of whole words, meaning a word is never partially rendered when WordEllipsis is used, with the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access