Poor performace in Storyboard.Begin() with KeyFrames animations
A am writing a WPF application that displays on the main canvas a lot (about 3000) of small objects. Each object has a storyboard containing one PointAnimationUsingKeyFrams and two DoubleAnimationUsingKeyFrames. Each animation has about 180 frames. Small objects mentioned above are implemented via user control - lets call it MyUserControl.
At first I calculate all frames for all objects. Of course, calculation of 3000*180 = 540,000 frames is a long work, and I am ready to some delay here. But after everything is calculated, I start all there storyboards:
foreach (UIElement el in MainCancas.Children) // about 3000 items
MyUserControl pc = el as MyUserControl;
if (pc != null) pc.Storyboard.Begin(pc, true); // 3 KeyFrames animations with 180 frames each one
This code fragment runs 11 seconds ! Why ?! All frames are already calculated - it just runs through 3000 items and starts some asynchronous operation for each of them.