Silverlight XAML Primer 13: Starting and Stopping Animations: Listing 1: Defining Storyboards within event triggers.

<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>
    <TextBlock Name="tbHello"
     Canvas.Left="36" Canvas.Top="80"
     Foreground="Maroon" FontFamily="Verdana" 
     FontSize="24" FontWeight="Bold"
     Text="Hello From Silverlight!">
    </TextBlock>
</Canvas>
comments powered by Disqus
Upcoming Events

.NET Insight

Sign up for our newsletter.

I agree to this site's Privacy Policy.