首页 > 其他分享 >WPF EventTrigger BeginStoryboard TargetName TargetProperty DoubleAnimation From To Duration AutoReve

WPF EventTrigger BeginStoryboard TargetName TargetProperty DoubleAnimation From To Duration AutoReve

时间:2024-12-30 12:40:43浏览次数:9  
标签:EventTrigger BeginStoryboard AutoReverse Duration TargetProperty DoubleAnimation

<Window x:Class="WpfApp116.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:WpfApp116"
        WindowState="Maximized"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <Grid.Triggers>
            <EventTrigger RoutedEvent="Grid.Loaded">
                <BeginStoryboard>
                    <Storyboard TargetName="img2"
                                TargetProperty="Opacity">
                        <DoubleAnimation From="1"
                                         To="0"
                                         Duration="0:0:4"
                                         AutoReverse="True"
                                         RepeatBehavior="Forever"/>
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger>
        </Grid.Triggers>
        <Image x:Name="img1" Source="Images/1.jpg"/>
        <Image x:Name="img2" Source="Images/2.jpg"/>
    </Grid>
</Window>

 

 

 

 

标签:EventTrigger,BeginStoryboard,AutoReverse,Duration,TargetProperty,DoubleAnimation
From: https://www.cnblogs.com/Fred1987/p/18640789

相关文章