我是 WPF(c#) 的新手。我需要使用 triggers
在图像控制周围制作发光效果。如何在 mouse-enter
事件上制作发光效果?
我想按照我的风格使用你的答案。
我的效果是:
<DropShadowEffect x:Key="MyEffect" ShadowDepth="0" Color="Blue" Opacity="1" BlurRadius="20"/>
我看到很多链接,但它们不起作用。
最佳答案
要向 Image
控件添加光晕,您需要在 IsMouseOver=True
时将 Effect
设置为您的 DropShadowEffect
,像这样:
<Image Source="/WpfApplication1;component/myimage.png">
<Image.Style>
<Style TargetType="{x:Type Image}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect ShadowDepth="0" Color="Blue" Opacity="1" BlurRadius="20"/>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
</Image.Style>
</Image>
关于c# - MouseEnter WPF 上的发光效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18399401/