0
我想要一个控件根据另一个属性更改其位置,但生成该新位置。但是,每当我开始新动画时,故事板都会将控件的位置重置为XAML中设置的属性。WP8.1:从当前位置开始动画
下面是我在做什么:
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();
有什么办法要么得到控制当前动画值设置为animation.From,或者是有没有办法告诉故事板从当前属性的位置开始?
当我一直在测试,Canvas.GetLeft总是返回在XAML中设置的值,而不是从故事板中设置的当前值。如果我开始一个新的故事板,它总是将Left值重置为XAML中设置的值。 – Jeff 2014-09-19 15:41:52