Storyboard的引用問題(附解決方法)
來源:程序員人生 發(fā)布時間:2014-06-18 14:18:00 閱讀次數(shù):2555次
<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>
想在代碼中動態(tài)控制旋轉(zhuǎn)的起始點,但不知道如何引用yFrom與yTo,Storyboard也沒有提供FindName之類的辦法,請高人指點一二
[已解決]剛自己解決了,發(fā)現(xiàn)直接在根節(jié)點下調(diào)用FindName就行了
System.Windows.Media.Animation.EasingDoubleKeyFrame yFrom = this.FindName("yFrom") as System.Windows.Media.Animation.EasingDoubleKeyFrame;
yFrom.Value = 20;
生活不易,碼農(nóng)辛苦
如果您覺得本網(wǎng)站對您的學習有所幫助,可以手機掃描二維碼進行捐贈