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 ...

Get Universal Windows® Apps with XAML and C# Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.