Print Page | Close Window

Event Trigger issue

Printed From: Codejock Forums
Category: General
Forum Name: XAML Snippets
Forum Description: Post your XAML snippets here for everyone to enjoy :)
URL: http://forum.codejock.com/forum_posts.asp?TID=17888
Printed Date: 20 April 2024 at 12:10am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Event Trigger issue
Posted By: Megalith
Subject: Event Trigger issue
Date Posted: 15 February 2011 at 12:37pm
Hi all,

Got an issue with triggering animations in xaml, my code creates resources for 3 objects which are animated, what i am looking for is to animate when the mouse is moved over the object and not when it inters the viewport. The code i'm using is a 3d ui testbed application but the procedure would i imagine be the same for any storyboard animation.

This block of code is where i have the issue

		<Viewport3D.Triggers>
            <EventTrigger RoutedEvent="Viewport3D.Loaded">
                <EventTrigger.Actions>
                    <BeginStoryboard Storyboard="{StaticResource OnLoaded}" />
                </EventTrigger.Actions>
            </EventTrigger>
            <EventTrigger RoutedEvent="Viewport3D.MouseEnter">
                <EventTrigger.Actions>
                    <BeginStoryboard Storyboard="{StaticResource OnMouseEnter}" />
                </EventTrigger.Actions>
            </EventTrigger>
        </Viewport3D.Triggers>

The line RoutedEvent="Viewport3D.MouseEnter" is where i have my issue. Here is the storyboard resource for OnMouseEnter.

               <Storyboard Duration="Forever" FillBehavior="HoldEnd" BeginTime="0:0:0" x:Key="OnMouseEnter"  d:StoryboardName="OnMouseEnter">

                    <Rotation3DAnimationUsingKeyFrames RepeatBehavior="Forever" BeginTime="0:0:0" Duration="0:0:2" Storyboard.TargetName="Box02OR17" Storyboard.TargetProperty="(Model3DGroup.Transform).(Transform3DGroup.Children)[2].(RotateTransform3D.Rotation)">
                    <LinearRotation3DKeyFrame KeyTime="0:0:0">
                        <LinearRotation3DKeyFrame.Value>
                            <AxisAngleRotation3D Angle="0.2457704544067372" Axis="0 0 1"/>
                        </LinearRotation3DKeyFrame.Value>
                    </LinearRotation3DKeyFrame>
                    <LinearRotation3DKeyFrame KeyTime="0:0:0.5">
                        <LinearRotation3DKeyFrame.Value>
                            <AxisAngleRotation3D Angle="45.00063628154822" Axis="-0.9999842950747802 0.002144721422138701 0.005177815544839366"/>
                        </LinearRotation3DKeyFrame.Value>
                    </LinearRotation3DKeyFrame>
                    <LinearRotation3DKeyFrame KeyTime="0:0:1">
                        <LinearRotation3DKeyFrame.Value>
                            <AxisAngleRotation3D Angle="0.2457704544067372" Axis="0 0 1"/>
                        </LinearRotation3DKeyFrame.Value>
                    </LinearRotation3DKeyFrame>
                    <LinearRotation3DKeyFrame KeyTime="0:0:1.5">
                        <LinearRotation3DKeyFrame.Value>
                            <AxisAngleRotation3D Angle="45.00063628154822" Axis="0.9999842950747802 -0.002144721422138701 0.005177815544839366"/>
                        </LinearRotation3DKeyFrame.Value>
                    </LinearRotation3DKeyFrame>
                    <LinearRotation3DKeyFrame KeyTime="0:0:2">
                        <LinearRotation3DKeyFrame.Value>
                            <AxisAngleRotation3D Angle="0.2457704544067372" Axis="0 0 1"/>
                        </LinearRotation3DKeyFrame.Value>
                    </LinearRotation3DKeyFrame>
                </Rotation3DAnimationUsingKeyFrames>
                </Storyboard>

How/What can i do to animate this storyboard when the mouse enters the specific resource rather than any resource in the ViewPort3D?



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net