EventTrigger Issue
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
Code:
< 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.
Code:
< 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?