Storyboard的引用问题(附解决方法)
栏目:综合技术时间:2014-06-18 14:18:00
<Storyboard x:Name="sbRotate">
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="img" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="0" x:Name="yFrom"/>
<EasingDoubleKeyFrame KeyTime="00:00:01" Value="360" x:Name="yTo"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
想在代码中动态控制旋转的起始点,但不知道如何引用yFrom与yTo,Storyboard也没有提供FindName之类的办法,请高人指点一二
[已解决]刚自己解决了,发现直接在根节点下调用FindName就行了
System.Windows.Media.Animation.EasingDoubleKeyFrame yFrom = this.FindName("yFrom") as System.Windows.Media.Animation.EasingDoubleKeyFrame;
yFrom.Value = 20;
------分隔线----------------------------
------分隔线----------------------------