[MainPage.xaml]


<UserControl x:Class="RiaColorAnimation.MainPage"

    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"

    mc:Ignorable="d"

    d:DesignHeight="300" d:DesignWidth="400">

 

    <Grid x:Name="LayoutRoot" Background="White">

        <!--[1] Storyboard-->

        <Grid.Triggers>

            <EventTrigger RoutedEvent="Grid.Loaded">

                <BeginStoryboard>

                    <Storyboard>

                        <ColorAnimation

                            Storyboard.TargetName="rect"

                            Storyboard.TargetProperty="(Rectangle.Fill).(SolidColorBrush.Color)"

 

                            Duration="0.0:0:5.0"

                            From="Red"

                            To="Blue"

                            AutoReverse="True"

                            RepeatBehavior="Forever"

                        />

                    </Storyboard>

                </BeginStoryboard>

            </EventTrigger>

        </Grid.Triggers>

        <!--[2] 사각형 -->

        <StackPanel>

            <Rectangle x:Name="rect" Width="100" Height="100" Fill="Red" Margin="10"

                Stroke="Yellow" StrokeThickness="3" RadiusX="10" RadiusY="5" />

        </StackPanel>

    </Grid>

</UserControl>

 

 





















Posted by holland14
: