1
我會直接去解決這個問題。在我的代碼,有省略號的陣列,即
Ellipse[] players = new Ellipse[11];
然後,我用DoubleAnimationWithKeyFrames在畫布動畫這些橢圓,用將動畫分配給WPF中的多個對象
sboard.Children.Add(anim);
sboard.Children.Add(anim2);
Storyboard.SetTargetName(anim, players[player - 1].Name);
Storyboard.SetTargetName(anim2, players[player - 1].Name);
Storyboard.SetTargetProperty(anim, new PropertyPath(Canvas.LeftProperty));
Storyboard.SetTargetProperty(anim2, new PropertyPath(Canvas.TopProperty));
但我想移動一些的TextBlocks這些橢圓。我如何將相同的anim和anim2分配給這些TextBlocks?