Je stocke un ensemble de contrôles dans un tableau et j'essaye d'animer tous les contrôles un par un dans une boucle mais je ne peux voir que le dernier en train d'animer?WP7 Problème d'animation de plusieurs contrôles
for (int i = 0; i < 4; i++)
{
Dispatcher.BeginInvoke(() =>
{
var sb = new Storyboard();
sb = CreateStoryboard(1.0, 0.0, this.Lights[0, i]);
sb.Begin();
});
}
private Storyboard CreateStoryboard(double from, double to, DependencyObject targetControl)
{
Storyboard result = new Storyboard();
DoubleAnimation animation = new DoubleAnimation();
animation.From = from;
animation.To = to;
animation.Duration = TimeSpan.FromSeconds(1);
animation.BeginTime = TimeSpan.FromSeconds(1);
animation.AutoReverse = false;
Storyboard.SetTarget(animation, targetControl);
Storyboard.SetTargetProperty(animation, new PropertyPath(UIElement.OpacityProperty));
result.Children.Add(animation);
return result;
}
Est-ce que ce changement d'approche signifie votre dernière question (http://stackoverflow.com/questions/4384159/wp7-ui-updating-issue) n'est pas plus valide? –
Veuillez noter que Windows Phone 7 utilise une version de Silverlight 3, pas 4. –