Files
docs-desktop/dotnet-desktop-guide/framework/wpf/graphics-multimedia/how-to-animate-a-boolean-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

2.1 KiB

title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
title ms.date dev_langs helpviewer_keywords ms.assetid
How to: Animate a Boolean by Using Key Frames 03/30/2017
csharp
vb
Booleans [WPF], animating with key frames
animation [WPF], Booleans with key frames
key frames [WPF], animating Booleans with
4b0fac96-6231-4fcf-9775-4dd673ddc785

How to: Animate a Boolean by Using Key Frames

This example shows how to animate the Boolean property value of a xref:System.Windows.Controls.Button control by using key frames.

Example

The following example uses the xref:System.Windows.Media.Animation.BooleanAnimationUsingKeyFrames class to animate the xref:System.Windows.UIElement.IsEnabled%2A property of a xref:System.Windows.Controls.Button control. All the key frames in this example use an instance of the xref:System.Windows.Media.Animation.DiscreteBooleanKeyFrame class. Discrete key frames like xref:System.Windows.Media.Animation.DiscreteBooleanKeyFrame create sudden jumps between values, that is, the movement of the animation is jerky.

[!code-csharpkeyframes_snip#BooleanAnimationUsingKeyFramesWholePage] [!code-vbkeyframes_snip#BooleanAnimationUsingKeyFramesWholePage] [!code-xamlkeyframes_snip#BooleanAnimationUsingKeyFramesWholePage]

For the complete sample, see KeyFrame Animation Sample.

See also