--- title: "How to: Animate a String by Using Key Frames" ms.date: "03/30/2017" helpviewer_keywords: - "animation [WPF], strings with key frames" - "strings [WPF], animating with key frames" - "key frames [WPF], animating strings with" ms.assetid: c62bc9fd-c09a-4227-bce0-0a1ab82049dd --- # How to: Animate a String by Using Key Frames This example shows how to animate a string, which in this example is the property of a control, by using key frames. ## Example The following example uses the class to animate the property of a . All the key frames in this example use an instance of the class because a string animation that is created with key frames can only use discrete key frames. Discrete key frames like create sudden jumps between values, that is, changes to the animation occur quickly and are not subtle. [!code-xaml[keyframes_snip#StringAnimationUsingKeyFramesWholePage](~/samples/snippets/xaml/VS_Snippets_Wpf/keyframes_snip/XAML/StringAnimationUsingKeyFramesExample.xaml#stringanimationusingkeyframeswholepage)] For the complete sample, see [KeyFrame Animation Sample](https://github.com/microsoft/WPF-Samples/tree/master/Animation/KeyFrameAnimation). ## See also - - - - - [Key-Frame Animations Overview](key-frame-animations-overview.md) - [Key-Frame How-to Topics](key-frame-animation-how-to-topics.md)