Hello,
I do something similiar in a graphing control I've made. The solution I came up with it to create an animation for each object. Although, you may be able to just retarget the animation and set the to/from values to whatever you'd like.
I've created a graphics helper class that handles building the animations for each object. This creates the animation through code, not building the xaml, but in managed code, here is a small example:
private
static void BuildRisingPathAnim(double start, double offset, LineSegment segment, PointAnimationUsingKeyFrames anim)
{SplinePointKeyFrame key = new SplinePointKeyFrame();key.SetValue(SplinePointKeyFrame.KeyTimeProperty, TimeSpan.FromSeconds(0));
key.Value = new Point(segment.Point.X, start);
key.KeySpline = new KeySpline();
key.KeySpline.ControlPoint1 =
new Point(0.5, 0.0);key.KeySpline.ControlPoint2 = new Point(0.5, 1.0);
anim.KeyFrames.Add(key);
}
Implementation:
PointAnimationUsingKeyFrames StartUAnim = new PointAnimationUsingKeyFrames();
StartUAnim.BeginTime =
TimeSpan.FromSeconds(0);Storyboard.SetTargetProperty(StartUAnim, "(Path.Data).(PathGeometry.Figures)[0].(PathFigure.StartPoint)");
BuildRisingPathAnim( val1, val2, (LineSegment)this.LineSegments[0], StartUAnim);
Here, I'm animating a path, with each segment starting it's animation just a bit behind the previous one.
Hope this helps even a little bit.
-Lewis