Skip to content

Latest commit

 

History

History
25 lines (18 loc) · 1.5 KB

how-to-make-an-element-spin-in-place.md

File metadata and controls

25 lines (18 loc) · 1.5 KB
title description ms.date helpviewer_keywords ms.assetid
How to: Make an Element Spin in Place
Learn how to make an element spin in place by using the RotateTransform and DoubleAnimation properties of the element.
03/30/2017
graphics [WPF], spinning elements
spinning elements [WPF]
1f011976-8b07-4c31-9faf-019e0ddaa24c

How to: Make an Element Spin in Place

This example shows how to make an element spin by using a xref:System.Windows.Media.RotateTransform and a xref:System.Windows.Media.Animation.DoubleAnimation.

The following example applies the xref:System.Windows.Media.RotateTransform to the xref:System.Windows.UIElement.RenderTransform%2A property of the element. The example uses a xref:System.Windows.Media.Animation.DoubleAnimation to animate the xref:System.Windows.Media.RotateTransform.Angle%2A of the xref:System.Windows.Media.RotateTransform. To make the element spin in place, the example sets the xref:System.Windows.UIElement.RenderTransformOrigin%2A property of the element to the point (0.5, 0.5).

Example

[!code-xamltransformanimations_snip#11]

For the complete sample, which includes more transformation examples, see 2D Transforms Sample.

See also