C# 在单击事件上设置xsl DropshadowEffect动画
大家好。 我在代码中的几个按钮元素上应用了.xaml样式表,需要在单击按钮时更改DropshadowEffect特性。 我的代码如下:C# 在单击事件上设置xsl DropshadowEffect动画,c#,.net,xaml,xslt,dropshadow,C#,.net,Xaml,Xslt,Dropshadow,大家好。 我在代码中的几个按钮元素上应用了.xaml样式表,需要在单击按钮时更改DropshadowEffect特性。 我的代码如下: <Style TargetType="{x:Type MyBtn}"> ... <Setter Property="Effect"> <Setter.value> <DropshadowEffect BlurRadius="10" ShadowDepht="5" Direction="-45"/>
<Style TargetType="{x:Type MyBtn}">
...
<Setter Property="Effect">
<Setter.value>
<DropshadowEffect BlurRadius="10" ShadowDepht="5" Direction="-45"/>
</Setter.Value>
</Setter>
...
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Mybtn}">
...
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="True">
<!-- Here I can change background and font colors properly,
but can't change the shadow of my buttons -->
</Trigger>
</ControlTemplate.Triggers>
</Setter.Value>
</Setter>
</Style>
有没有办法通过单击或按下事件更改DropShadow效果?
谢谢 +1来否定你得到的无法解释的否决票,因为这些票对任何人都没有帮助。然而,如果您在您最喜欢的搜索引擎中快速搜索类似于设置阴影效果xaml动画的内容,您会很快得到答案。在为Dropshadoweffect指定x:Name之后,您只需针对其属性应用动画。此外,示例中的阴影深度拼写错误。无论哪种方式,试一下,试过之后再来。欢迎来到苏好的,我试试看。非常感谢!