KetticTreeView Control for WinForms Build complex navigation systems and display complex hierarchical structures Formatting Nodes of KetticTreeView in C#.NET
KetticTreeView WinForms control allows the developers to format the nodes of KetticTreeView. This control is virtualized so that we can reuse the visual nodes, the TreeNodeElement, through the KetticTreeNode data nodes. To format the node, we shall handle the NodeFormatting event by assigning the arguments of this event to the data Nodes to return the visual Node. And then we can format the visual Node, as well as customize the appearance of the node. C# Format Nodes of KetticTreeView
In the C# tutorial, we are going to format nodes to display various images for the nodes of KetticTreeView. The sample below mimics a tree of files and folders to show a closed folder image as a node including different nodes is collapsed and to show an opened folder image as a node including different nodes is expanded. The steps below demonstrate how to do this.
- First, we shall use some nodes representing files and folders to fill the KetticTreeView
- Second, we need to add three images to the KetticTreeView as the resources and then use the images to indicate whether a node is a file, an opened folder or a closed folder.
- Third, implement the NodeFormatting event
- And then set the image to the Image property of the ImageElement, which contains the image of the visual NodeElement
- The following C# code shows how to achieve this
|