-
June 25th, 2011, 10:31 AM
#1
Poor performace in Storyboard.Begin() with KeyFrames animations
Hi,
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.
Two questions
1) Why ?
2) How to improve ?
Best regards
Borr
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|