I animate a label to move up the screen using the following code:
private void Animate(object sender, EventArgs e)
{
Storyboard scrollTweets = new Storyboard();
DoubleAnimation ani = new DoubleAnimation();
ani.From = (double)label1.GetValue(Canvas.TopProperty);
ani.To = (double)label1.GetValue(Canvas.TopProperty) - label1.ActualHeight;
ani.Duration = new Duration(TimeSpan.FromSeconds(1));
Storyboard.SetTarget(ani, label1);
Storyboard.SetTargetProperty(ani, new PropertyPath(Canvas.TopProperty));
scrollTweets.Children.Add(ani);
scrollTweets.Completed += scroll_Completed;
scrollTweets.Begin();
}
In the complete event I try to change it's position like this:
private void scroll_Completed(object sender, EventArgs e)
{
label1.SetValue(Canvas.TopProperty, 400.00);
}
This does not seem to do anything. However if I change the top property of the control before I animate it the control's position changes just fine. Is the animation doing something to the canvas property. How can I change the labels top property after animating it. Any help will be appreciated. Thanks.