So… pasting code is still tricky. But I think this will work. This code is what I used when I wanted to rotate an Image object declared in XAML. To be clear, this allows me to create a rotating image without any C# or VB code. Personally I chose to rotate this picture:
The CenterX and CenterY property of RotateTransform should be half of the Image objects width and height. This can be found by using databindings but that’s another post completely.
<Style x:Key="AnimationImage" TargetType="{x:Type Image}">
<Setter Property="RenderTransform">
<Setter.Value>
<RotateTransform Angle="0" CenterX="20" CenterY="20" />
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="true">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="RenderTransform.Angle"
From="0" To="360" Duration="0:0:1.5" RepeatBehavior="Forever" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
</Trigger>
</Style.Triggers>
</Style>
