< StackPanel > < StackPanel.Resources > < Storyboard x:Name = " storyboard " > < ObjectAnimationUsingKeyFrames Storyboard.TargetName = " rectangle " Storyboard.TargetProperty = " Fill " Duration = " 0:0:4 " RepeatBehavior = " Forever " > < DiscreteObjectKeyFrame KeyTime = " 0:0:2 " > < DiscreteObjectKeyFrame.Value > < LinearGradientBrush > < LinearGradientBrush.GradientStops > < GradientStop Color = " Yellow " Offset = " 0.0 " /> < GradientStop Color = " Orange " Offset = " 0.5 " /> < GradientStop Color = " Red " Offset = " 1.0 " /> </ LinearGradientBrush.GradientStops > </ LinearGradientBrush > </ DiscreteObjectKeyFrame.Value > </ DiscreteObjectKeyFrame > < DiscreteObjectKeyFrame KeyTime = " 0:0:3 " > < DiscreteObjectKeyFrame.Value > < RadialGradientBrush GradientOrigin = " 0.75,0.25 " > < RadialGradientBrush.GradientStops > < GradientStop Color = " White " Offset = " 0.0 " /> < GradientStop Color = " MediumBlue " Offset = " 0.5 " /> < GradientStop Color = " Black " Offset = " 1.0 " /> </ RadialGradientBrush.GradientStops > </ RadialGradientBrush > </ DiscreteObjectKeyFrame.Value > </ DiscreteObjectKeyFrame > </ ObjectAnimationUsingKeyFrames > </ Storyboard > </ StackPanel.Resources > < Rectangle x:Name = " rectangle " Loaded = " Start_Animation " Width = " 300 " Height = " 200 " /> </ StackPanel > note:Only discrete interpolation (DiscreteObjectKeyFrame) is available for use with ObjectAnimationUsingKeyFrames which merely swaps objects according toa specified timeline. Other types of interpolation are too problematic to applyto objects