2016-08-08 11 views
0

私は今は完全に失われています。私のアニメーションで何が間違っていますか?なぜそれが動いていないのですか?どんな助けも高く評価されるでしょう!私はバーがいっぱいになっているかのように「回転している」円形のプログレスバーを開発したいと思っています。UWP - 私の単純なアニメーションが実行されない理由

次のコードは、MainPageのLoaded Handlerで空のUWPアプリケーション内で実行されます。その他...

ArcSegment myArcSegment = new ArcSegment(); 
myArcSegment.Size = new Size(90, 80); 
myArcSegment.SweepDirection = SweepDirection.Clockwise; 

PathSegmentCollection myPathSegmentCollection = new PathSegmentCollection(); 
myPathSegmentCollection.Add(myArcSegment); 

PathFigure myPathFigure = new PathFigure(); 

myPathFigure.StartPoint = new Point(100, 200); 

myPathFigure.Segments = myPathSegmentCollection; 

PathFigureCollection myPathFigureCollection = new PathFigureCollection(); 
myPathFigureCollection.Add(myPathFigure); 

PathGeometry myPathGeometry = new PathGeometry(); 
myPathGeometry.Figures = myPathFigureCollection; 

Path myPath = new Path(); 
myPath.Stroke = new SolidColorBrush(Colors.Aqua); 
myPath.StrokeThickness = 1; 

myPath.Data = myPathGeometry; 

PointAnimation mySizeAnimation = new PointAnimation(); 
mySizeAnimation.Duration = TimeSpan.FromSeconds(2); 

mySizeAnimation.From = new Point(90, 80); 
mySizeAnimation.To = new Point(500, 200); 

Storyboard.SetTarget(mySizeAnimation, myArcSegment); 
Storyboard.SetTargetProperty(mySizeAnimation, nameof(ArcSegment.Point)); 

Storyboard ellipseStoryboard = new Storyboard(); 
ellipseStoryboard.Children.Add(mySizeAnimation); 

myPath.Loaded += delegate (object o, RoutedEventArgs e) 
{ 
    ellipseStoryboard.Begin(); 
}; 

Canvas containerCanvas = new Canvas(); 
containerCanvas.Children.Add(myPath); 

Content = containerCanvas; 

ありがとうございました!

答えて

1

私のああ...私はこの記事を読んで:私はEnableDependendAnimationプロパティについて読ん偶然http://blog.jerrynixon.com/2012/06/windows-8-animated-pie-slice.html

を...それを聞いたことはありませんが、これをtrueに設定するだけでアニメーションの実行を作りました。私は今それを読むでしょう。とにかく、ありがとう!

関連する問題