<Page
    x:Class="GradientBrushPointAnimation.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:GradientBrushPointAnimation"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid>
        <Grid.Background>
            <LinearGradientBrush x:Name="gradientBrush">
                <GradientStop Offset="0" Color="Red" />
                <GradientStop Offset="1" Color="Blue" />
            </LinearGradientBrush>
        </Grid.Background>
    </Grid>
    
    <Page.Triggers>
        <EventTrigger>
            <BeginStoryboard>
                <Storyboard RepeatBehavior="Forever">
                    <PointAnimationUsingKeyFrames Storyboard.TargetName="gradientBrush"
                                                  Storyboard.TargetProperty="StartPoint"
                                                  EnableDependentAnimation="True">
                        <LinearPointKeyFrame KeyTime="0:0:0" Value="0 0" />
                        <LinearPointKeyFrame KeyTime="0:0:1" Value="1 0" />
                        <LinearPointKeyFrame KeyTime="0:0:2" Value="1 1" />
                        <LinearPointKeyFrame KeyTime="0:0:3" Value="0 1" />
                        <LinearPointKeyFrame KeyTime="0:0:4" Value="0 0" />
                    </PointAnimationUsingKeyFrames>
                    
                    <PointAnimationUsingKeyFrames Storyboard.TargetName="gradientBrush"
                                                  Storyboard.TargetProperty="EndPoint"
                                                  EnableDependentAnimation="True">
                        <LinearPointKeyFrame KeyTime="0:0:0" Value="1 1" />
                        <LinearPointKeyFrame KeyTime="0:0:1" Value="0 1" />
                        <LinearPointKeyFrame KeyTime="0:0:2" Value="0 0" />
                        <LinearPointKeyFrame KeyTime="0:0:3" Value="1 0" />
                        <LinearPointKeyFrame KeyTime="0:0:4" Value="1 1" />
                    </PointAnimationUsingKeyFrames>
                </Storyboard>
            </BeginStoryboard>
        </EventTrigger>
    </Page.Triggers>
</Page>
