Edit this page

Using Checkboxes

Enable the check boxes by setting the CheckBoxes property to true. By default all nodes display check boxes when the CheckBoxes property is true. To suppress showing a checkbox next to a particular RadTreeNode set the node CheckType property to None. To check a node programmatically, use the Checked or CheckState properties of RadTreeNode. When the user clicks a checkbox the NodeCheckChanged event fires passing a RadTreeViewEventArgs object that contains the checked Node.

Tri-State CheckBoxes

Tri-state check boxes in addition to checked and unchecked states also have a "indeterminate" state. To enable this feature set the TriStateMode property to true. The screen shot below shows that "Node1" is in Indeterminate state to indicate that its children are not allĀ checked.

treeview-working-with-nodes-using-checkboxes 001

note

When TriStateMode is set to true, the CheckBoxes property is also set to true automatically.

To programmatically set the state when TriStateMode is true assign the CheckState property one of the ToggleState enumeration values.

treeview-working-with-nodes-using-checkboxes 002

Option Tree Support

RadTreeView the supportsĀ option trees that allows radio buttons and check boxes to be mixed in order to form an arbitrary complex option tree. The only limitation is that all sibling nodes must have either check boxes or radio buttons. Check boxes and radio buttons can be mixed in a single RadTreeNodeCollection. The RadTreeNode property that control the type of option element to be shown (check box or radio button) is CheckType:

treeview-working-with-nodes-using-checkboxes 003

RadTreeNode Node1 = new RadTreeNode("Node1");
Node1.Expanded = true;
Node1.CheckType = CheckType.RadioButton;
RadTreeNode Node2 = new RadTreeNode("Node2");
RadTreeNode Node3 = new RadTreeNode("Node3");
RadTreeNode Node4 = new RadTreeNode("Node4");
radTreeView1.Nodes.Add(Node1);
radTreeView1.Nodes.Add(Node2);
Node1.Nodes.Add(Node3);
Node1.Nodes.Add(Node4);

Dim Node1 As New RadTreeNode("Node1")
Node1.Expanded = True
Node1.CheckType = ChildListType.OptionList
Dim Node2 As New RadTreeNode("Node2")
Dim Node3 As New RadTreeNode("Node3")
Dim Node4 As New RadTreeNode("Node4")
RadTreeView1.Nodes.Add(Node1)
RadTreeView1.Nodes.Add(Node2)
Node1.Nodes.Add(Node3)
Node1.Nodes.Add(Node4)

See Also