--- title: "How to: Animate a Boolean by Using Key Frames" ms.date: "03/30/2017" dev_langs: - "csharp" - "vb" helpviewer_keywords: - "Booleans [WPF], animating with key frames" - "animation [WPF], Booleans with key frames" - "key frames [WPF], animating Booleans with" ms.assetid: 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 control by using key frames. ## Example The following example uses the class to animate the property of a control. All the key frames in this example use an instance of the class. Discrete key frames like create sudden jumps between values, that is, the movement of the animation is jerky. [!code-csharp[keyframes_snip#BooleanAnimationUsingKeyFramesWholePage](~/samples/snippets/csharp/VS_Snippets_Wpf/keyframes_snip/CSharp/BooleanAnimationUsingKeyFramesExample.cs#booleananimationusingkeyframeswholepage)] [!code-vb[keyframes_snip#BooleanAnimationUsingKeyFramesWholePage](~/samples/snippets/visualbasic/VS_Snippets_Wpf/keyframes_snip/visualbasic/booleananimationusingkeyframesexample.vb#booleananimationusingkeyframeswholepage)] [!code-xaml[keyframes_snip#BooleanAnimationUsingKeyFramesWholePage](~/samples/snippets/xaml/VS_Snippets_Wpf/keyframes_snip/XAML/BooleanAnimationUsingKeyFramesExample.xaml#booleananimationusingkeyframeswholepage)] 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)