Silverlight performance with a large number of Objects Org Chart.
- by KC
Hello,
I’m working on a org chart project(SL 3) and I’m seeing the UI thread hang when the chart is building around 2,000 nodes and when it renders it takes about a min and then FPS drop to a crawl.
Here is the code flow.
Page.xaml.cs calls a wcf service that returns a list of AD users. Then we use Linq to build a collection of nodes to bind to the Orgchart.cs
OrgChart.cs is a canvas and displays a collection of nodes and connecting lines.
Node.cs is a canvas and has user data can contain children nodes.
NodeContent.xaml is a user control that has borders so I can set the background, textblocks to display user's data, Events that handle the selected and expaned nodes, and storyboards that resize the nodes when they are selected or expanded.I noticed during hours of debugging , here in the InitializeComponent(); section where it loads the xaml it seems to be where the preformance hit is happening.
System.Windows.Application.LoadComponent(this, new System.Uri("/Silverlight.Custom;component/NodeContent.xaml", System.UriKind.Relative));
So I guess I have two questions.
Can threading help in any way with the UI thread hanging while drawing the nodes?
How can I avoid the hit when calling this user control?
Any advice or direction anyone can lend would be greatly appreciated.
Thanks,
KC