WPF Animation - Why My Image Will Not Rotate?

I created a simple user control in WPF and added an image to it:

<Image x:Name="logo" Source="/View/Images/Logo.png" Width="100" Height="100"> <Image.RenderTransform> <RotateTransform Angle="0" CenterX="50" CenterY="50" /> </Image.RenderTransform> </Image> 

I want this image to constantly rotate and disappear. This should be used as an indicator of employment. So I created this animation storyboard:

 <Storyboard RepeatBehavior="Forever"> <DoubleAnimation From="0" To="360" Duration="00:00:05" Storyboard.TargetName="logo" Storyboard.TargetProperty="(RotateTransform.Angle)" /> <DoubleAnimation From="0.1" To="1" AutoReverse="True" Duration="00:00:02" Storyboard.TargetName="logo" Storyboard.TargetProperty="Opacity" /> </Storyboard> 

However, when I look at a window with a usercontrol in it, fading works, but spiinning does not.

+4
source share
1 answer

Your StoryBoard.TargetProperty is wrong, it should be:

 Storyboard.TargetProperty="(Image.RenderTransform).(RotateTransform.Angle)" 
+4
source

All Articles