J'essaie d'animer la largeur d'un contrôle de bordure dans une application Windows 8 Metro. J'ai réussi à animer d'autres propriétés de la bordure, comme l'opacité :
private void Item_Tapped(object sender, RoutedEventArgs e)
{
var border = sender as Border;
var animation = new DoubleAnimation();
animation.To = 0.0;
animation.Duration = new Duration(TimeSpan.FromSeconds(1));
var storyboard = new Storyboard();
storyboard.Children.Add(animation);
Storyboard.SetTarget(animation, border);
Storyboard.SetTargetProperty(animation, "Opacity");
storyboard.Begin();
}
Mais lorsque j'essaie d'animer la largeur du contrôle :
private void Item_Tapped(object sender, RoutedEventArgs e)
{
var border = sender as Border;
var animation = new DoubleAnimation();
animation.To = 600.0;
animation.Duration = new Duration(TimeSpan.FromSeconds(1));
var storyboard = new Storyboard();
storyboard.Children.Add(animation);
Storyboard.SetTarget(animation, border);
Storyboard.SetTargetProperty(animation, "Width");
storyboard.Begin();
}
Rien ne se passe.
Je suis capable de le faire dans WPF, mais pas dans Windows 8. Est-ce une limitation ou un bogue de Metro, ou est-ce que je fais quelque chose de mal ?
Gracias