Thursday, May 06, 2010

Custom Tree Control

The default TreeView control provided by .Net framework
  • Doesn't have the capability to highlight which nodes are selected or not selected if all the nodes are collapsed. It takes to expand all the nodes to see which all are selected.
  • Though it provides feature to style LeafNode, ParentNode, SelectedNode etc; it doesn't have the capability to style individual/selected nodes
Custom Tree Control developed on top of the default TreeView control as shown below has the capability to perform the above mentioned features. Screenshot below.
Solution for point1 mentioned above
It highlights the node with green image if all the nodes under it is checked, with red image if none of its child nodes are checked, with blue image if some of the child nodes are checked
Solution for point2 mentioned above
Assuming that we want to highlight text of some nodes in red color [here it is to highlight inactive items. In this scenario all the items under node Level3 is assumed to be as inactive] we can achieve it.



Drop me a mail @ praveen.balanagendra@gmail.com for the source code.

1 comment:

Ramesh Bhaskar said...

Looks really neat man. Nice work.