[英]Set Bitmap Effect on Hover in WPF Visual Studio
I have a border element on which I have bitmap effect of shadow:我有一个边框元素,上面有 bitmap 阴影效果:
<Border x:Name="ListItemPressable"
Background="{StaticResource CanvasBrush}"
CornerRadius="5"
MouseDown="ListItemPressed" Cursor="Hand"
BitmapEffect="{StaticResource BottomShadowEffect}">
</Border>
I want to show this bitmap effect only when border element is hovered on.我只想在边框元素悬停时显示此 bitmap 效果。 How can I achieve this thing?我怎样才能做到这一点?
Ok I just figured it out myself.好的,我只是自己想通了。 For anyone looking for it, here's solution:对于任何寻找它的人,这里是解决方案:
<Border.Style>
<Style TargetType="{x:Type Border}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BitmapEffect" Value="{StaticResource BottomShadowEffect}"/>
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.