Performance issues when reloading data into Silverlight™ components of Gantt Chart Light Library

If you reinitialize the Items collection of the Silverlight™ based Gantt Chart components from Gantt Chart Light Library, you may notice that sometimes the reload operation runs slower than the initial load of a large data amount, although this issue doesn't occur with the same WPF based components and the same data amount.

Based on our investigations, we have found that Silverlight™ may sometimes trigger its internal Garbage Collector when old items in the control are removed to be replaced by a new, refreshed object collection, and as the control itself remains in the visual tree, finding the elements to be garbage collected from the visual representation of the removed items may get difficult, and this could cause the application to temporarily freeze until the internal operation is completed.

A workaround exists to resolve the problem: instead of just resetting the Items collection of the components, remove the component instance from the visual tree, and replace it with a new instance, created on the fly (the code below assumes that the GanttChartDataGrid component is the last element inside the LayoutRoot panel):

LayoutRoot.Children.Remove(GanttChartDataGrid);
GanttChartDataGrid = new GanttChartDataGrid { ... };
LayoutRoot.Children.Add(GanttChartDataGrid);