3
votes

I have a textblock with a long text that is displayed in several lines (as textblock width is not enough to display every letter).

I'd like to have some words are bold, and it's important to keep text displayed in several lines as before. How would you decorate parts of a text?

"the quick brown fox jumped over the lazy yellow dog."

If TextBlock abilities are not enough (thank you, @BoltClock) may be I should split TextBlock into several ones, or manipulate TextBlock.Inlines or something?

1
I don't think a text block is suited for rich text. You could make a custom TextBlock subclass and perform the formatting there though.BoltClock♦

1 Answers

8
votes

You can use runs:

<TextBlock.Inlines>
    <Run Text="the quick brown " />
    <Run FontStyle="Bold" Text="fox" />
    <Run Text=" jumped over the lazy yellow " />
    <Run FontStyle="Bold" Text="dog" />
    <Run Text="." />
</TextBlock.Inlines>