答案 0 :(得分:1)
您可以使用offset
<TextBlock FontSize="72">
<Run Foreground="Gray" Text="It" /><Run Text="e">
<Run.Foreground>
<LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
<GradientStop Color="Gray" Offset="0"/>
<GradientStop Color="Gray" Offset="0.5" />
<GradientStop Color="Red" Offset="0.5" />
<GradientStop Color="Red" Offset="1" />
</LinearGradientBrush>
</Run.Foreground>
</Run><Run Text="m" Foreground="Red" /><Run Text=" 1">
<Run.Foreground>
<LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
<GradientStop Color="Red" Offset="0"/>
<GradientStop Color="Red" Offset="0.5" />
<GradientStop Color="Gray" Offset="0.5" />
<GradientStop Color="Gray" Offset="1" />
</LinearGradientBrush>
</Run.Foreground>
</Run>
</TextBlock>
参考:Foreground colour of textblock based on position of part of the letter