Make a Part of Text Bold inside TextBlock

Viewed 13084

I know that we can use <Run> in XAML to achieve what I am asking :

<TextBlock.Inlines>
    <Run Text="This is" />
    <Run FontWeight="Bold" Text="Bold Text." />
</TextBlock.Inlines>

Also I can do it in code behind as follows:

TextBlock.Inlines.Add(new Run("This is"));
TextBlock.Inlines.Add(new Bold(new Run("Bold Text.")));

But my problem is something different:

Suppose I have following Text in my database:

This is <b>Bold Text</b>.

Now, my Textblock is bound to a field that contains the above text in database.

I want the text between <b> and </b> to be bold. How can I achieve this?

3 Answers
Related