DiscretePointKeyFrame Object

Animates from the Point value of the previous key frame to its own Value using discrete values.

<DiscretePointKeyFrame .../>
To create an object using scripting, see CreateFromXAML.


A key frame defines a segment of the PointAnimationUsingKeyFrames to which it belongs. Each key frame has a target Value and a KeyTime. The KeyTime specifies the time at which the key frame's Value should be reached. A key frame animates from the target value of the previous key frame to its own target value. It starts when the previous key frame ends and ends when its own key time is reached.

Discrete key frames like DiscretePointKeyFrame create sudden "jumps" between values (no interpolation). The animated property does not change until the key frame's key time is reached at which point the animated property goes suddenly to the target value.


The following example moves an ellipse along a triangular path. The example uses the PointAnimationUsingKeyFrames class to animate the Center property of an EllipseGeometry. This animation uses three key frames in the following manner:

  1. During the first half second, uses an instance of the LinearPointKeyFrame class to move the ellipse along a path at a steady rate from its starting position. Linear key frames like LinearPointKeyFrame create a smooth linear interpolation between values.
  2. During the end of the next half second, uses an instance of the DiscretePointKeyFrame class to suddenly move the ellipse along the path to the next position. Discrete key frames like DiscretePointKeyFrame create sudden jumps between values.
  3. During the final two seconds, uses an instance of the SplinePointKeyFrame class to move the ellipse back to its starting position. Spline key frames like SplinePointKeyFrame create a variable transition between values according to the values of the KeySpline property. KeySpline provides a way to alter the relationship of time versus value during the animation duration to be nonlinear, and in particular the relationship can be a curve that would be difficult to produce with individual keyframes. In this example, the animation begins slowly and speeds up exponentially toward the end of the time segment.
  Width="400" Height="300">
  <Path Fill="Blue">

      <!-- Describes an ellipse. -->
      <EllipseGeometry x:Name="MyAnimatedEllipseGeometry"
       Center="200,100" RadiusX="15" RadiusY="15" />

      <EventTrigger RoutedEvent="Path.Loaded">

            <!-- Animating the Center property uses 3 KeyFrames, which animate
                 the ellipse allong a triangular path. -->
              Duration="0:0:5" RepeatBehavior="Forever">

              <!-- Over the first half second, Using a LinearPointKeyFrame, the ellipse 
                   moves steadily from its starting position along the first line of the 
                   trianglar path.  -->
                Value="100,300" />

              <!-- Using a DiscretePointKeyFrame, the ellipse suddenly changes position
                   after the first second of the animation. -->
                Value="400,300" />

              <!-- Using a SplinePointKeyFrame, the ellipse moves back to its starting
                   position. It moves slowly at first and then speeds up. This key frame 
                   takes 2 seconds to complete. -->
                KeySpline="0.6,0.0 0.9,0.00" 
                Value="200,100" />

See Also

Silverlight Key-Frame Animations Overview

Community Additions