MS Surface, SVI animation in a straight line
So I am trying to move the ScatterViewItem from 1 point to another. I've tried using PointAnimation. However, after the animation finishes, I cannot move the element from the To point. I can rotate the element and scale it, but for some reason it cannot move it.
This is a simple movement from 1 point to the next in a straight line. Should I use PointAnimation or is there a better way? Thanks, I am doing this in C #
My animation point code:
oPointAnimation = new PointAnimation();
oPointAnimation.From = new Point(439, 113);
oPointAnimation.To = new Point(139, 160);
oPointAnimation.Duration = TimeSpan.FromSeconds(4);
oPointAnimation.Completed += new EventHandler(oPointAnimation_Completed);
theCard.BeginAnimation(ScatterViewItem.CenterProperty, oPointAnimation);
While you already have an accepted answer, I would like to add a point here.
Even if the FillBehavior is set to Stop, there are certain cases where it just doesn't work. I believe it has something to do with the HandoffBehavior set to SnapshotAndReplace. What I was doing in these cases was to programmatically start a new animation (using BeginAnimation ) on this dependency property with null
as the second argument.
// Remove all animations for the Opacity property on the myElement element
myElement.BeginAnimation(UIElement.OpacityProperty, null)
This effectively clears all animations for that dependency property and you can freely assign new values ββto it.
source to share