Line Number | Syntax Highlight | Download Raw
LinkedIn


<UserControl x:Class="Silverlight3._4._2._3.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:DesignWidth="640" d:DesignHeight="480">
 
        <UserControl.Resources>
            
            <Storyboard x:Name="myStoryboard">


                <!-- Animate the center point of the ellipse. -->
                <PointAnimation Storyboard.TargetProperty="Center"

                        Storyboard.TargetName="MyAnimatedEllipseGeometry"

                        Duration="0:0:5" From="20,200" To="400,100"

                        RepeatBehavior="Forever" />

            </Storyboard>

        </UserControl.Resources>
      
      
        <Canvas>
            <Path Fill="Blue">
                <Path.Data>
                    <!-- Describe an ellipse. -->
                    <EllipseGeometry 
                        x:Name="MyAnimatedEllipseGeometry"
                        Center="20,20" RadiusX="15" RadiusY="15" />
                </Path.Data>
            </Path>


            <StackPanel Orientation="Horizontal" Canvas.Left="10" Canvas.Top="265">

                <!-- Button that begins animation. -->
                <Button Click="Animation_Begin"     

                        Width="65" Height="30" Margin="2"

                        Content="Begin" />


                <!-- Button that pauses animation. -->
                <Button Click="Animation_Pause"

                        Width="65" Height="30" Margin="2" 

                        Content="Pause" />


                <!-- Button that resumes animation. -->
                <Button Click="Animation_Resume"

                        Width="65" Height="30" Margin="2" 

                        Content="Resume" />


                <!-- Button that stops animation. 

                  Stopping the animation returns the ellipse to its original location. -->
                <Button Click="Animation_Stop"

                        Width="65" Height="30" Margin="2" 

                        Content="Stop" />
            </StackPanel>
        </Canvas>


</UserControl>




Back to recent pastes