我如何为用户控件的边距设置动画?我想直接在Window后台代码中执行此操作。这就是我所拥有的:
addServer = new AddServer();
addServer.Height = 300;
addServer.Width = 570;
// 252, 248, 26, 0
addServer.Margin = new Thickness(252, 550, 26, 0);
Main.Children.Add(addServer);
DoubleAnimation doubleAnimation = new DoubleAnimation();
doubleAnimation.From = 550;
doubleAnimation.To = 248;
doubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(5));
Storyboard storyboard = new Storyboard();
storyboard.Children.Add(doubleAnimation);
Storyboard.SetTargetName(doubleAnimation, addServer.Name);
Storyboard.SetTargetProperty(doubleAnimation, new PropertyPath(addServer.Margin));
AddServer是我想要动画的UserControl。我希望实现的是动画中的飞行。