我有一个WPF应用程序。我有一个矩形,我想用我创建的径向画笔填充。但是,当我使用我的径向画笔的名称设置fill属性的值时,它告诉我令牌是无效的吗?
<RadialGradientBrush x:Key="brushRadSecurity" RadiusY="0.825" RadiusX="0.669">
<RadialGradientBrush.RelativeTransform>
<TransformGroup>
<ScaleTransform CenterY="0.5" CenterX="0.5" ScaleY="1.248" ScaleX="1.276"/>
<SkewTransform CenterY="0.5" CenterX="0.5"/>
<RotateTransform CenterY="0.5" CenterX="0.5"/>
<TranslateTransform Y="0.317" X="-0.007"/>
</TransformGroup>
</RadialGradientBrush.RelativeTransform>
<GradientStop Color="#940FDCDC" Offset="0"/>
<GradientStop Offset="1"/>
<GradientStop Color="#94022FF3" Offset="0.974"/>
<GradientStop Color="#940092C9" Offset="0.526"/>
<GradientStop Color="#940FDCDC" Offset="0.25"/>
<GradientStop Color="#940052C9" Offset="0.703"/>
</RadialGradientBrush>
<Style x:Key="recSecurity" TargetType="Rectangle">
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="VerticalAlignment" Value="Stretch"/>
<Setter Property="Opacity" Value="0"/>
<Setter Property="RadiusX" Value="10"/>
<Setter Property="RadiusY" Value="10"/>
<Setter Property="StrokeThickness" Value="0"/>
<Setter Property="Fill" Value="brushRadSecurity"/>
</Style>
答案 0 :(得分:2)
应该阅读
<Setter Property="Fill" Value="{StaticResource brushRadSecurity}"/>
答案 1 :(得分:2)
试试这个
<Setter Property="Fill" Value="{StaticResource brushRadSecurity}"/>