Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

ThicknessKeyFrame.Value Property

Gets or sets the key frame's target value.

Namespace:  System.Windows.Media.Animation
Assembly:  PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
member Value : Thickness with get, set

    <Thickness .../>
<object Value="Thickness" .../>

Property Value

Type: System.Windows.Thickness
The key frame's target value, which is the value of this key frame at its specified KeyTime. The default value is 0.

Identifier field


Metadata properties set to true


This example shows how to animate the value of a property that takes a Double by using key frames.

The following example moves a rectangle across a screen. The example uses the DoubleAnimationUsingKeyFrames class to animate the X property of a TranslateTransform applied to a Rectangle. This animation, which repeats indefinitely, uses three key frames in the following manner:

  1. During the first three seconds, uses an instance of the LinearDoubleKeyFrame class to move the rectangle along a path at a steady rate from its starting position to the 500 position. Linear key frames like LinearDoubleKeyFrame create a smooth linear transition between values.

  2. At the end of the fourth second, uses an instance of the DiscreteDoubleKeyFrame class to suddenly move the rectangle to the next position. Discrete key frames like DiscreteDoubleKeyFrame create sudden jumps between values. In this example, the rectangle is at the starting position and then suddenly appears at the 500 position.

  3. In the final two seconds, uses an instance of the SplineDoubleKeyFrame class to move the rectangle back to its starting position. Spline key frames like SplineDoubleKeyFrame create a variable transition between values according to the value of the KeySpline property. In this example, the rectangle begins by moving slowly and then speeds up exponentially toward the end of the time segment.

No code example is currently available or this language may not be supported.

<!-- This example shows how to use the DoubleAnimationUsingKeyFrames to 
     animate the position of an object. 
     Key frame animations enable you to create complex animations 
     by specifying multiple destination values
     and controlling the animation's interpolation method.
  Title="DoubleAnimationUsingKeyFrames Example"
  Background="White" Margin="20">       
  <Canvas Width="610" Height="300">

    <!-- The position of this rectangle is animated using 
         a key frame animation. -->
        <TranslateTransform x:Name="AnimatedTranslateTransform" />

        <EventTrigger RoutedEvent="Rectangle.Loaded">

              <!-- Animate the TranslateTransform.X property using 3 KeyFrames
                   which animates the rectangle along a straight line. 
                   This animation repeats indefinitely. -->

                <!-- Using a LinearDoubleKeyFrame, the rectangle moves 
                     steadily from its starting position to 500 over 
                     the first 3 seconds.  -->
                <LinearDoubleKeyFrame Value="500" KeyTime="0:0:3" />

                <!-- Using a DiscreteDoubleKeyFrame, the rectangle suddenly 
                     appears at 400 after the fourth second of the animation. -->
                <DiscreteDoubleKeyFrame Value="400" KeyTime="0:0:4" />

                <!-- Using a SplineDoubleKeyFrame, the rectangle moves 
                     back to its starting point. The
                     animation starts out slowly at first and then speeds up. 
                     This KeyFrame ends after the 6th
                     second. -->
                <SplineDoubleKeyFrame KeySpline="0.6,0.0 0.9,0.00" Value="0" KeyTime="0:0:6" />

For the complete sample, see KeyFrame Animation Sample.

For consistency with other animation examples, the code versions of this example use a Storyboard object to apply the DoubleAnimationUsingKeyFrames. Alternatively, when applying a single animation in code, it is simpler to use the BeginAnimation method instead of using a Storyboard. For an example, see How to: Animate a Property Without Using a Storyboard.

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.