Question

I have this code for expanding and contracting images in a sexy manner. I'd like to add a little rotation in there, just to make the image pop up, you know?

Where/how do I add rotation animations to control?

<Style.Triggers>
                <EventTrigger RoutedEvent="Image.MouseEnter">
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation Duration="0:0:0.25" From="1" To="1.2" AutoReverse="True"
                                     Storyboard.TargetProperty="RenderTransform.ScaleX"/>
                            <DoubleAnimation Duration="0:0:0.1" From="1" To="1.2" AutoReverse="True" 
                                     Storyboard.TargetProperty="RenderTransform.ScaleY"/>
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>             
</Style.Triggers>
Was it helpful?

Solution

You need to set RenderTransform to a TransformGroup containing a RotateTransform and a ScaleTransform, then animate the RotateTransform's Angle property.

OTHER TIPS

Download Blend and use that. You can create storyboards and rotate you objects with that. It will generate all the XAML for you... you can learn that way

Coding animations kinda defeats the point of WPF

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top