所以我做了这个彩色画笔:
<!-- TEXT -->
<LinearGradientBrush x:Key="TextColor" StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#FFD9EDFF" Offset="0"/>
<GradientStop Color="#FFC0DEFF" Offset="0.445"/>
<GradientStop Color="#FFAFD1F8" Offset="0.53"/>
</LinearGradientBrush>
我正在尝试为所有标签设置它,但我无法弄清楚语法,这就是我所拥有的:
<Style TargetType="{x:Type Label}">
<Setter Property="Foreground">
<Setter.Value>
<LinearGradientBrush x:Name="{StaticResource TextColor}" />
</Setter.Value>
</Setter>
</Style>
这会引发错误说:
Error 1 MarkupExtensions are not allowed for Uid or Name property values, so '{StaticResource TextColor}' is not valid.
我该怎么办?
答案 0 :(得分:0)
试试这个:
<Style TargetType="{x:Type Label}">
<Setter Property="Foreground" Value="{StaticResource TextColor}"/>
</Style>