首页 新闻 赞助 找找看

WPF的问题,请问如何实现 鼠标放进图片上 添加动态阴影效果

0
悬赏园豆:50 [待解决问题]

代码如下,想实现鼠标放进去,阴影变多点,但是无效果,请大神指点下!

<Window x:Class="WpfApp3.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp3"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">

<Window.Resources>
    <Style x:Key="abc" TargetType="{x:Type Image}">

        <Style.Triggers>
            <EventTrigger RoutedEvent="Mouse.MouseEnter">
                <BeginStoryboard>
                    <Storyboard>
                        <DoubleAnimation Duration="0:0:0.2" Storyboard.TargetProperty="(DropShadowEffect.BlurRadius)" From="3" To="10"/>
                    </Storyboard>

                </BeginStoryboard>


            </EventTrigger>
        </Style.Triggers>

    </Style>

</Window.Resources>

<Grid Background="#FFE2E2E2">
    <Image Style="{StaticResource abc}" HorizontalAlignment="Left" Height="87.028" Margin="278.311,145.934,0,0" VerticalAlignment="Top" Width="148.585" Source="未标题-1.png">
        <Image.Effect>
            <DropShadowEffect x:Name="dse" Color="#FFC5C5C5" ShadowDepth="5"  BlurRadius="3"/>
        </Image.Effect>
    </Image>

</Grid>

</Window>

5184的主页 5184 | 初学一级 | 园豆:152
提问于:2021-04-08 16:58
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册