Files
docs-desktop/dotnet-desktop-guide/framework/wpf/graphics-multimedia/how-to-animate-a-string-by-using-key-frames.md
T
Andy De George da363692ff Initial WPF content migrated (#17)
* Reset branch for WPF changes

* Convert BMP to PNG; fix link-out-of-scope err

* Add snippets for WPF... 6794 files!!!!

* Add missing snippets

* update file updated between migration

* Fix paths to include

* update breadcrumb and toc

* fix index links

* fix index links

* fix index links

* fix markdown
2020-09-04 09:46:28 -07:00

1.9 KiB

title, ms.date, helpviewer_keywords, ms.assetid
title ms.date helpviewer_keywords ms.assetid
How to: Animate a String by Using Key Frames 03/30/2017
animation [WPF], strings with key frames
strings [WPF], animating with key frames
key frames [WPF], animating strings with
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 xref:System.Windows.Controls.ContentControl.Content%2A property of a xref:System.Windows.Controls.Button control, by using key frames.

Example

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.

[!code-xamlkeyframes_snip#StringAnimationUsingKeyFramesWholePage]

For the complete sample, see KeyFrame Animation Sample.

See also