Search code examples
windowswindows-phone-7textblock

In windows phone 7 is it possible to put a gradient colour inside a textblock?


In windows phone 7 is it possible to put a gradient colour inside a textblock?

For example in the XAML part is there a way to indicate style and apply a linear gradient?

Also if so can the gradient be applied dynamically


Solution

  • Try this for foreground

    <TextBlock.Foreground>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
            GradientStop Color="Black" Offset="0"/>
            <GradientStop Color="#FFFF6565" Offset="1"/>
        </LinearGradientBrush>
    </TextBlock.Foreground>
    

    If you need fill background - put textblock inside container