Is it possible to seletively color a label in Silverlight?

fonts, layout, silverlight, xaml

Solution

Yeah, it would be like this:

<Canvas>
    <dataInput:Label Background="White" >
    <dataInput:Label.Foreground>
        <LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
            <GradientStop Color="Red" Offset="0.1"/>
            <GradientStop Color="Green" Offset="0.1"/>
        </LinearGradientBrush>
    </dataInput:Label.Foreground>
    Blah blah bladity blah
    </dataInput:Label>
</Canvas>

In order to not have the gradient effect, you need to set both `Offset` to the same value.

Note: In this font size (standard, nothing changed) the "B" and "l" are red and only a small sliver of "a" is. But the "0.1" in `Offset` means 10%, so you can either decrease font size or change the `Offset` value.

Problem

For instance, if I have a label: `Blah blah bladity blah` I want the first 10% of this label, such that the font color should be red, and the rest should be green. This perhaps means it would color the Bl and PART of the a. Basically pixel-wise font coloring instead of character-wise. Is this possible and how would is be accomplished?

Original source