Is it possible to apply a background color to the inline text of a TextBlock instead of the entire rectangular bounds of the TextBlock? In other words, I would like to have this:
<TextBlock TextWrapping="Wrap">
<!-- No such "Background" property -->
<Span Background="Red">
The quick brown fox jumps over the lazy dog
</Span>
</TextBlock>
(Just like <span style="background-color: red">
in HTML)
Instead of this:
<Border Background="Red">
<TextBlock TextWrapping="Wrap">
The quick brown fox jumps over the lazy dog
</TextBlock>
</Border>
Is this even supported? I've been looking through the documentation for the TextBlock and RichTextBlock classes but I can't see any way of setting the background of the inline text. I think WPF supports this.
EDIT
I should mention, I need this to work with automatically wrapped text. I don't know how many lines there will be, or else I could just manually use a Border for each line of text.