Silverlight XAML Primer 11: Getting Started with Animations: Listing 1. Using storyboards and animations in Silverlight.

<Canvas xmlns="http://schemas.microsoft.com/client/2007">
    <Canvas.Triggers>
        <EventTrigger RoutedEvent="Canvas.Loaded">
            <BeginStoryboard>
                <Storyboard>
	     <DoubleAnimation AutoReverse="True" From="80" To="200" 
                       Duration="0:0:3" 
	        Storyboard.TargetName="tbHello"
	        Storyboard.TargetProperty="(Canvas.Left)" RepeatBehavior="Forever"/>
	 </Storyboard>
            </BeginStoryboard>
        </EventTrigger>
    </Canvas.Triggers>
    <Canvas Canvas.Left="10" Canvas.Top="10" Height="300" Width="300" Background="#efefef">
        <Rectangle Canvas.Top="25" Canvas.Left="25" 
            Width="200" Height="150" Fill="Yellow" />
        <TextBlock Name="tbHello"
             Canvas.Left="36" Canvas.Top="80"
             Foreground="Maroon" FontFamily="Verdana" 
             FontSize="24" FontWeight="Bold"
             Text="Hello From Silverlight!">
        </TextBlock>
    </Canvas>
</Canvas>
comments powered by Disqus
Upcoming Events

.NET Insight

Sign up for our newsletter.

I agree to this site's Privacy Policy.