$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
KetticTreeView Control for WinForms
Build complex navigation systems and display complex hierarchical structures
Home > WinForms UI Controls > User Manual > Formatting Nodes in TreeView in C#

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.
  1. First, we shall use some nodes representing files and folders to fill the KetticTreeView
  2. 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.
  3. Third, implement the NodeFormatting event
  4. And then set the image to the Image property of the ImageElement, which contains the image of the visual NodeElement
  5. The following C# code shows how to achieve this
UI Controlsfor Windows Forms
.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls