tags:

views:

46

answers:

1

I've 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 that image to spin constantly and to fade in and out. This is to be used as a busy indicator. 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 view a window with the usercontrol in it, the fading works but the spiinning doesn't.

+2  A: 

Your StoryBoard.TargetProperty is wrong, it should be:

Storyboard.TargetProperty="(Image.RenderTransform).(RotateTransform.Angle)"
Thomas Levesque