views:

847

answers:

1

Hello,

Let's say I have some multiline text that I'd like to format, and let's also say that it's databound. So, in XAML:

<TextBlock TextWrap="Wrap">
    <TextBlock.Inlines>
        <Run TextWeight="Bold" Text="{Binding Path=FirstName}" />
        <Run TextStyle="Italic Text="{Binding Path=LastName}" />
    </TextBlock.Inlines>
</TextBlock>

Now, this doesn't work because Run's Text isn't a dependency property. So, I'm wondering, what is the best way to style inline databound text like this?

Thanks in advance.

+1  A: 

There is a workaround posted here. It basically involves subclassing Run to be bindable. Works though.

Andrew Barrett