Animate the background color : Color Animation « Windows Presentation Foundation « C# / CSharp Tutorial






<Window x:Class="Main"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Title="" Height="300" Width="300"
  Background="Black">
  <Window.Triggers>
    <EventTrigger RoutedEvent="Window.Loaded">
      <BeginStoryboard>
        <Storyboard AutoReverse="True" RepeatBehavior="Forever">
          <ColorAnimation Storyboard.TargetProperty="Background.Color" To="White" />
          <ColorAnimation Storyboard.TargetName="rect" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" To="Firebrick" />
        </Storyboard>
      </BeginStoryboard>
    </EventTrigger>
  </Window.Triggers>
  <Rectangle x:Name="rect" Width="100" Height="100" Fill="WhiteSmoke" />
</Window>
WPF Animate The Background Color








24.109.Color Animation
24.109.1.Animate RadialGradientAnimate RadialGradient
24.109.2.Animate OpacityAnimate Opacity
24.109.3.Animate GradientStop and Button controlAnimate GradientStop and Button control
24.109.4.Animate the Color of a Brush with Indirect Property TargetingAnimate the Color of a Brush with Indirect Property Targeting
24.109.5.Opacity AnimationOpacity Animation
24.109.6.Animate the background colorAnimate the background color
24.109.7.Animate the brush's RadiusX property.Animate the brush's RadiusX property.