Storyboard的引用问题(附解决方法)
来源:程序员人生 发布时间:2014-06-18 14:18:00 阅读次数:2320次
<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;
生活不易,码农辛苦
如果您觉得本网站对您的学习有所帮助,可以手机扫描二维码进行捐赠