【发布时间】:2014-09-19 14:42:04
【问题描述】:
我希望控件根据另一个属性更改其位置,但动画到该新位置。但是,每当我启动新动画时,故事板都会将控件的位置重置为 XAML 中设置的属性。
这就是我正在做的事情:
var animation = new DoubleAnimation();
animation.Duration = TimeSpan.FromSeconds(0.1);
// This gets the value that was set in the XAML, not the current value
// animation.From = Canvas.GetLeft(BackgroundImage);
animation.To = newLocation;
Storyboard.SetTarget(animation, BackgroundImage);
Storyboard.SetTargetProperty(animation, "(Canvas.Left)");
Storyboard story = new Storyboard();
story.Children.Add(animation);
story.Begin();
有没有办法从控件获取当前动画值以设置为动画。从,或者有没有办法告诉故事板从当前属性的位置开始?
【问题讨论】:
标签: c# xaml animation windows-phone-8.1