I am dynamically building an org chart in Silverlight 2 by adding lots of Grid containers to a canvas. Each grid container represents a node within the chart. I am capturing click events for the nodes as follows:
grid.MouseLeftButtonUp += new MouseButtonEventHandler(grid_MouseLeftButtonUp);
By design, each click event changes the look of the tree, so on capturing a click event I rebuild the entire org tree. This works ok for two or three clicks, but after that everything just hangs when I click a node (Grid). Each time I rebuild the tree I clear the base canvas using:
_canvasBase.Children.Clear();
I am wondering if I need to specifically clear all the event delegates before clearing all the canvas children? Or might something else be happening to cause the hang?