Storyboard for Animating Color : Storyboard « Windows Presentation Foundation « VB.Net






Storyboard for Animating Color

Storyboard for Animating Color
       

<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Animation">
    <Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
      <Button Padding="30">
        OK
        <Button.Background>
          <LinearGradientBrush>
            <GradientStop Color="Blue" Offset="0"/>
            <GradientStop Color="Black" Offset="0.5"/>
            <GradientStop Color="Blue" Offset="1"/>
          </LinearGradientBrush>
        </Button.Background>
        <Button.Triggers>
          <EventTrigger RoutedEvent="Button.Loaded">
            <EventTrigger.Actions>
              <BeginStoryboard>
                <Storyboard>
                  <ColorAnimation From="Black" To="White" Duration="0:0:2"
                  Storyboard.TargetProperty="Background.GradientStops[1].Color"
                  AutoReverse="True" RepeatBehavior="Forever"/>
                </Storyboard>
              </BeginStoryboard>
            </EventTrigger.Actions>
          </EventTrigger>
        </Button.Triggers>
      </Button>
    </Canvas>
</Window>

   
    
    
    
    
    
    
  








Related examples in the same category

1.Targeting named elementsTargeting named elements
2.Write StoryBoard for Animating Width from one value to another with duration and RepeatBehaviorWrite StoryBoard for Animating Width from one value to another with duration and RepeatBehavior
3.Limit the Frame Rate of a StoryboardLimit the Frame Rate of a Storyboard
4.Animation RepeatBehavior Forever
5.Object Loading Event Trigger EventObject Loading Event Trigger Event
6.Define Animation Trigger and StoredBoard for EllipseDefine Animation Trigger and StoredBoard for Ellipse
7.Time based RepeatBehaviourTime based RepeatBehaviour
8.Two color animationsTwo color animations
9.Create an animation using the storyboardCreate an animation using the storyboard
10.Remove Animations with StoryboardRemove Animations with Storyboard
11.Storyboard: A child with a fill periodStoryboard: A child with a fill period