Fetching contributors…
Cannot retrieve contributors at this time
29 lines (23 sloc) 2 KB
title helpviewer_keywords ms.assetid
How to: Animate a String by Using Key Frames
animation [WPF], strings with key frames
strings [WPF], animating with key frames
key frames [WPF], animating strings with

How to: Animate a String by Using Key Frames

This example shows how to animate a string, which in this example is the xref:System.Windows.Controls.ContentControl.Content%2A property of a xref:System.Windows.Controls.Button control, by using key frames.


The following example uses the xref:System.Windows.Media.Animation.StringAnimationUsingKeyFrames class to animate the xref:System.Windows.Controls.ContentControl.Content%2A property of a xref:System.Windows.Controls.Button.

All the key frames in this example use an instance of the xref:System.Windows.Media.Animation.DiscreteStringKeyFrame class because a string animation that is created with key frames can only use discrete key frames. Discrete key frames like xref:System.Windows.Media.Animation.DiscreteStringKeyFrame create sudden jumps between values, that is, changes to the animation occur quickly and are not subtle.


For the complete sample, see KeyFrame Animation Sample.

See Also

Key-Frame Animations Overview
Key-Frame How-to Topics