0
正確。我需要在Canvas下C#中任何WPF Usercontrol動畫的愚蠢示例。 我嘗試了story.Begin(??????)下的所有組合。 但它總是給出一個錯誤。任何線索傢伙?C中的用戶控件動畫#
Storyboard story = new Storyboard();
DoubleAnimation dbWidth = new DoubleAnimation();
dbWidth.From = 0;
dbWidth.To = 200;
dbWidth.Duration = new Duration(TimeSpan.FromSeconds(.25));
DoubleAnimation dbHeight = new DoubleAnimation();
dbHeight.From = 0;
dbHeight.To = 200;
dbHeight.Duration = dbWidth.Duration;
story.Children.Add(dbWidth);
Storyboard.SetTargetName(dbWidth, PluginUControl.Name);
Storyboard.SetTargetProperty(dbWidth, new PropertyPath(UserControl.WidthProperty));
story.Children.Add(dbHeight);
Storyboard.SetTargetName(dbHeight, PluginUControl.Name);
Storyboard.SetTargetProperty(dbHeight, new PropertyPath(UserControl.HeightProperty));
story.Begin(??????);
更新:
而且我試圖做這樣的
story.Begin((MainWindow)App.Current.Windows[0]);
我猜測,這是一樣的story.Begin(本); 但沒有成功......
http://stackoverflow.com/questions/342829/wpf-animations-in-a-user-control-learning-trying-瞭解但感覺 –
謝謝!但我需要通過C#代碼完成100% –