I have many items (Nodes) grouped by category and I want to display them in a TreeView where parent are text and children are CheckBoxes :
+-CategoryA(Text) ---.A1(CheckBox) ---.A2(CheckBox) +-CategoryB(Text) ---.B1 ---.B2 ---.B3 +-CategoryC(Text) ---.C1(CheckBox) ---.C2(CheckBox) Here is a code sample :
TreeNode testNodeA = new TreeNode("A"); TreeNode testNodeB = new TreeNode("B"); TreeNode testNodeC = new TreeNode("C"); TreeNode[] array = new TreeNode[] { testNodeA, testNodeB, testNodeC }; TreeNode cat = new TreeNode("Categorie X", array); myTreeView.Nodes.Add(cat); I already found a similar question Here, but the solution is not elegant since it uses p/invoke to call a C++ code.