RichTextBlock
A typical first reaction to discovering the RichTextBlock
element is, “Isn’t TextBlock
already rich?” TextBlock
can do a lot when it comes to formatting text, but RichTextBloc
k adds two big new tricks:
→ Embedding arbitrary UIElement
s among text
→ Letting text overflow into separate elements, which enables multi-column text or other custom text layouts
Except for these two features, TextBlock
and RichTextBlock
are almost identical. They expose the same methods, properties, and events, although RichTextBlock
happens to have an extra GetPositionFromPoint
method that returns a TextPointer
for the passed-in Point
. RichTextBlock
also has some different defaults: IsTextSelectionEnabled
is true
by default, and TextWrapping
is Wrap
by ...
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.