tags:

views:

45

answers:

1

After executing this code...

DoubleAnimation a = new DoubleAnimation(newWidth, new Duration(...));
ThicknessAnimation b = new ThicknessAnimation(new Thickness(...), new Duration(...));
border.BeginAnimation(Border.MarginProperty, b);
border.BeginAnimation(Border.WidthProperty, a);

...this code no longer works (Margin does not change after assigning a new value):

// doesn't have any effect
border.Margin = new Thickness(...);

What's going on?? Thanks!

A: 

From Dependency Properties Overview:

Dependency properties can be animated. When an animation is applied and is running, the animated value operates at a higher precedence than any value (such as a local value) that the property otherwise has.

You'll need to set the animation's FillBehavior to Stop for the local value to take precedence.

micahtan