aşağıdaki kod Silverlight çalışıyor:WinRT/Metro Animasyon kod arkasında
o tek küçük bir değişiklik ihtiyacı WinRT/Metro'daprivate void Button_Click_1(object sender, RoutedEventArgs e)
{
Storyboard storyboard = new Storyboard();
DoubleAnimation doubleAnimation = new DoubleAnimation();
doubleAnimation.From = 50;
doubleAnimation.To = 100;
doubleAnimation.RepeatBehavior = RepeatBehavior.Forever;
doubleAnimation.AutoReverse = true;
doubleAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(200));
storyboard.Children.Add(doubleAnimation);
Storyboard.SetTarget(doubleAnimation, button1);
Storyboard.SetTargetProperty(doubleAnimation, new PropertyPath("Width"));
storyboard.Begin();
}
derlemek yapmak:
Storyboard.SetTargetProperty(doubleAnimation, "Width");
ama sizi Koş, hiçbir şey olmuyor.
Özelliği "Genişlik" ten "Opaklık" a (aynı zamanda Kimden = 0 ve Git = 1) değiştirirseniz, bu işlev çalışır.
"Genişlik" ile ilgili sorun nedir?
Tüm bu kodu xaml'e taşımak için niçin 'EventTrigger' http://msdn.microsoft.com/en-us/library/system.windows.eventtrigger.aspx'i kullanmadınız? – RredCat
@RredCat - Bildiğim kadarıyla WinRT'de EventTrigger yok. –