Skip to main content Skip to footer

Creating TreeViews using FlexGrid for Silverlight

Silverlight 4 tree view have one performance problem, when you try to expand a node with 1000 odd children, it takes close to 10 to 14 second to load. But it is only the initial cost, once the data loaded into memory, when you expand or collapse the same node it expands quickly. If you have many number of nodes with 1000s of children then you are going incur the cost of each node expansion. As you can imagine it does not go very well with the end users. For starters, it will not go past QA when they see that bad of performance. So I was thinking about adopting data grid to display the same content, yet make it look like tree view. The reason I chose grid instead of any other controls is virtualization. I tested a simple grid with same amount of data in it and it was simply amazing. It was so fast. You can't time it since it expand and collapse instantly.

I have been using a ComponentOne control lately for our development and I very comfortable using it. I decided to develop the grid using C1FlexGrid and one of its power feature called cell factory. I never really appreciated the full power of till I attempted to solve my problem using cellfactory. I decided to blog about it as a document of this feature and as a reference for future.

Read More...

FlexGrid user Unni has written a wonderful 3-part tutorial on using C1FlexGrid for Silverlight to create TreeViews which are much more performant than using the native TreeView. You can read the full posts from Unni's blog below.

Creating TreeView using Grid in Silverlight (Component One - Cell Factory) - I

Creating TreeView using Grid in Silverlight (Component One - Cell Factory) - II

Creating TreeView using Grid in Silverlight (Component One - Cell Factory) - III

ComponentOne Product Manager Greg Lutz

Greg Lutz

comments powered by Disqus