Silverlight XAML Primer 14: Using Color Animations: Listing 1: Defining ColorAnimation elements in multiple storyboards.

<Canvas xmlns="http://schemas.microsoft.com/client/2007">
  <Canvas.Resources>
    <Storyboard Name="OverAnimation">
      <ColorAnimation Storyboard.TargetName="tbCanvas" 
        Storyboard.TargetProperty="(Foreground).(Color)" Duration="0:0:0.75" 
        From="Maroon" To="Green" />
    </Storyboard>
    <Storyboard Name="OutAnimation">
      <ColorAnimation Storyboard.TargetName="tbCanvas"
        Storyboard.TargetProperty="(Foreground).(Color)" Duration="0:0:0.75"
        From="Green" To="Maroon" />
    </Storyboard>
  </Canvas.Resources>
  <TextBlock Name="tbCanvas" MouseEnter="OnMouseEnter" 
    MouseLeave="OnMouseLeave"
    Canvas.Left="0" 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.