Text Overflow

If you place more text in a RichTextBlock (or TextBlock) than what fits in its bounds, you could wrap it in a ScrollViewer to make it all readable. RichTextBlock, however, supports a nifty trick that enables text that doesn’t fit to spill into a special element called RichTextBlockOverflow that you can place anywhere. If the remaining content doesn’t all fit in the RichTextBlockOverflow, it can spill into another RichTextBlockOverflow, and so on.

To enable this feature, all you need to do is set RichTextBlock’s OverflowContentTarget property to the desired RichTextBlockOverflow instance. RichTextBlockOverflow has its own OverflowContentTarget property so you can keep chaining RichTextBlockOverflows to each other. You could use this ...

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