349 references to Nodes
System.Windows.Forms (30)
System\Windows\Forms\Controls\TreeView\TreeNode.cs (10)
139
Nodes
.AddRange(children);
158
Nodes
.AddRange(children);
670
if (_parent is not null && _index + 1 < _parent.
Nodes
.Count)
672
return _parent.
Nodes
[_index + 1];
821
int fixedInd = _parent.
Nodes
.FixedIndex;
828
if (currentInd > 0 && currentInd <= _parent.
Nodes
.Count)
830
return _parent.
Nodes
[currentInd - 1];
1384
node.
Nodes
.Add((TreeNode)_children[i].Clone());
1580
Nodes
.AddRange(childNodes);
1724
foreach (TreeNode child in parentNode.
Nodes
)
System\Windows\Forms\Controls\TreeView\TreeNode.TreeNodeAccessibleObject.cs (3)
194
if (_owningTreeNode.
Nodes
.Count == 0)
204
if (_owningTreeNode.
Nodes
.Count == 0)
216
if (_owningTreeNode.
Nodes
.Count == 0)
System\Windows\Forms\Controls\TreeView\TreeNodeCollection.cs (6)
225
_owner.
Nodes
.FixedIndex = _owner._childCount;
234
_owner.
Nodes
.FixedIndex = -1;
281
if ((treeNodeCollectionToLookIn[i].
Nodes
is not null) && treeNodeCollectionToLookIn[i].
Nodes
.Count > 0)
284
foundTreeNodes = FindInternal(key, searchAllChildren, treeNodeCollectionToLookIn[i].
Nodes
, foundTreeNodes);
326
int fixedIndex = _owner.
Nodes
.FixedIndex;
System\Windows\Forms\Controls\TreeView\TreeNodeConverter.cs (6)
50
if (node.
Nodes
.Count == 0)
59
TreeNode[] nodesArray = new TreeNode[node.
Nodes
.Count];
60
node.
Nodes
.CopyTo(nodesArray, 0);
67
if (node.
Nodes
.Count == 0)
92
TreeNode[] nodesArray = new TreeNode[node.
Nodes
.Count];
93
node.
Nodes
.CopyTo(nodesArray, 0);
System\Windows\Forms\Controls\TreeView\TreeView.cs (5)
1706
foreach (TreeNode child in node.
Nodes
)
2666
for (int i = node.
Nodes
.Count - 1; i >= 0; i--)
2668
UpdateCheckedState(node.
Nodes
[i], update);
2674
for (int i = node.
Nodes
.Count - 1; i >= 0; i--)
2676
UpdateCheckedState(node.
Nodes
[i], update);
System.Windows.Forms.Design (39)
System\ComponentModel\Design\ObjectSelectorEditor.Selector.cs (4)
46
parent.
Nodes
.Add(newNode);
159
if ((treeNodes[i].
Nodes
is not null) && (treeNodes[i].
Nodes
.Count != 0))
162
if (SetSelection(value, treeNodes[i].
Nodes
))
System\Windows\Forms\Design\DesignBindingPicker.cs (19)
551
if (_projectNode.
Nodes
.Count > 0)
553
_otherNode.
Nodes
.Add(_projectNode);
556
if (_instancesNode.
Nodes
.Count > 0)
558
_otherNode.
Nodes
.Add(_instancesNode);
561
if (_otherNode.
Nodes
.Count > 0)
634
AddDataSource(_instancesNode?.
Nodes
, comp, null);
699
AddDataSourceContents(dataSourceNode.
Nodes
, dataSource, dataMember, properties);
923
AddDataMemberContents(dataMemberNode.
Nodes
, dataMemberNode);
955
AddProjectGroupContents(_projectNode?.
Nodes
, g);
960
AddProjectGroup(_projectNode?.
Nodes
, g, addMembers);
979
AddProjectGroupContents(groupNode.
Nodes
, group);
1144
AddProjectDataSourceContents(projectDataSourceNode.
Nodes
, projectDataSourceNode);
1239
AddProjectDataMemberContents(projectDataMemberNode.
Nodes
, projectDataMemberNode, dataSourceDescriptor, propertyDescriptor, dataSourceInstance);
1619
else if (_instancesNode.
Nodes
.Count > 0 || _projectNode?.
Nodes
.Count > 0)
1713
int dataMemberCount = _selectedNode.
Nodes
.Count;
1733
_treeViewCtrl?.SetSelectedItem(_selectedNode.
Nodes
[0]);
2033
maxWidth = Math.Max(maxWidth, GetMaxItemWidth(node.
Nodes
));
2174
foreach (BindingPickerNode node in
Nodes
)
System\Windows\Forms\Design\TreeNodeCollectionEditor.cs (16)
91
while (lastNode.
Nodes
.Count > 0)
93
lastNode = lastNode.
Nodes
[lastNode.
Nodes
.Count - 1];
164
newNode = parent.
Nodes
.Add(baseNodeName + NextNode++.ToString(CultureInfo.InvariantCulture));
545
dropNode.
Nodes
.Add(dragNode);
629
_treeView1.Nodes[tempNode.Index].
Nodes
.Insert(0, tempNode);
633
parent.
Nodes
.RemoveAt(tempNode.Index);
634
if (tempNode.Index < parent.
Nodes
.Count)
636
parent.
Nodes
[tempNode.Index].
Nodes
.Insert(0, tempNode);
646
parent.Parent.
Nodes
.Insert(parent.Index + 1, tempNode);
663
_treeView1.Nodes[tempNode.Index - 1].
Nodes
.Add(tempNode);
667
parent.
Nodes
.RemoveAt(tempNode.Index);
676
parent.Parent.
Nodes
.Insert(parent.Index, tempNode);
681
parent.
Nodes
[tempNode.Index - 1].
Nodes
.Add(tempNode);
System.Windows.Forms.Tests (280)
System\Windows\Forms\AccessibleObjects\TreeNode.TreeNodeAccessibleObjectTests.cs (8)
508
node.
Nodes
.Add("ChildNode");
522
firstLevelNode.
Nodes
.Add(secondLevelNode);
524
secondLevelNode.
Nodes
.Add(thirdLevelNode);
542
firstLevelNode.
Nodes
.Add(secondLevelNode);
559
firstLevelNode.
Nodes
.Add(secondLevelNode);
561
secondLevelNode.
Nodes
.Add(thirdLevelNode);
579
firstLevelNode.
Nodes
.Add(secondLevelNode);
581
secondLevelNode.
Nodes
.Add(thirdLevelNode);
System\Windows\Forms\TreeNode.IKeyboardToolTipTests.cs (17)
173
TreeNode firstSubNode = rootNode.
Nodes
[0];
179
Assert.Contains(GetRectangle(treeView, rootNode.
Nodes
[1]), neighboringRectangles);
192
TreeNode middleSubNode = rootNode.
Nodes
[1];
197
Assert.Contains(GetRectangle(treeView, rootNode.
Nodes
[0]), neighboringRectangles);
198
Assert.Contains(GetRectangle(treeView, rootNode.
Nodes
[2]), neighboringRectangles);
211
TreeNode lastSubNode = rootNode.
Nodes
[2];
216
Assert.Contains(GetRectangle(treeView, rootNode.
Nodes
[1]), neighboringRectangles);
230
TreeNode lastSubNode = rootNode.
Nodes
[2];
232
TreeNode subSubNode = lastSubNode.
Nodes
[0];
257
Assert.Contains(GetRectangle(treeView, firstNode.
Nodes
[2]), neighboringRectangles);
270
TreeNode subNode = firstNode.
Nodes
[2];
278
Assert.Contains(GetRectangle(treeView, subNode.
Nodes
[0]), neighboringRectangles);
291
TreeNode lastSubNode = rootNode.
Nodes
[2];
297
Assert.Contains(GetRectangle(treeView, rootNode.
Nodes
[1]), neighboringRectangles);
298
Assert.Contains(GetRectangle(treeView, lastSubNode.
Nodes
[0]), neighboringRectangles);
432
subNode3.
Nodes
.Add(subSubNode);
433
rootNode1.
Nodes
.AddRange([subNode1, subNode2, subNode3]);
System\Windows\Forms\TreeNodeCollectionTests.cs (6)
42
Assert.Empty(treeNode.
Nodes
);
43
Assert.Same(treeNode.
Nodes
, treeNode.
Nodes
);
167
child3.
Nodes
.Add(grandchild1);
168
child3.
Nodes
.Add(grandchild2);
169
child3.
Nodes
.Add(grandchild3);
System\Windows\Forms\TreeNodeTests.cs (127)
37
Assert.Empty(node.
Nodes
);
38
Assert.Same(node.
Nodes
, node.
Nodes
);
77
Assert.Empty(node.
Nodes
);
78
Assert.Same(node.
Nodes
, node.
Nodes
);
125
Assert.Equal(children, node.
Nodes
.Cast<TreeNode>());
126
Assert.Same(node.
Nodes
, node.
Nodes
);
168
Assert.Empty(node.
Nodes
);
169
Assert.Same(node.
Nodes
, node.
Nodes
);
216
Assert.Equal(children, node.
Nodes
.Cast<TreeNode>());
217
Assert.Same(node.
Nodes
, node.
Nodes
);
1626
parent.
Nodes
.Add(node1);
1627
parent.
Nodes
.Add(node2);
1628
parent.
Nodes
.Add(node3);
1629
node3.
Nodes
.Add(node4);
1646
parent.
Nodes
.Add(node1);
1647
parent.
Nodes
.Add(node2);
1648
parent.
Nodes
.Add(node3);
1649
node3.
Nodes
.Add(node4);
1668
parent.
Nodes
.Add(node1);
1669
parent.
Nodes
.Add(node2);
1670
parent.
Nodes
.Add(node3);
1671
node3.
Nodes
.Add(node4);
2036
parent.
Nodes
.Add(node1);
2037
parent.
Nodes
.Add(node2);
2038
parent.
Nodes
.Add(node3);
2039
node3.
Nodes
.Add(node4);
2056
parent.
Nodes
.Add(node1);
2057
parent.
Nodes
.Add(node2);
2058
parent.
Nodes
.Add(node3);
2059
node3.
Nodes
.Add(node4);
2078
parent.
Nodes
.Add(node1);
2079
parent.
Nodes
.Add(node2);
2080
parent.
Nodes
.Add(node3);
2081
node3.
Nodes
.Add(node4);
2155
parent.
Nodes
.Add(node1);
2156
parent.
Nodes
.Add(node2);
2157
parent.
Nodes
.Add(node3);
2158
node3.
Nodes
.Add(node4);
2175
parent.
Nodes
.Add(node1);
2176
parent.
Nodes
.Add(node2);
2177
parent.
Nodes
.Add(node3);
2178
node3.
Nodes
.Add(node4);
2197
parent.
Nodes
.Add(node1);
2198
parent.
Nodes
.Add(node2);
2199
parent.
Nodes
.Add(node3);
2200
node3.
Nodes
.Add(node4);
2272
parent.
Nodes
.Add(node1);
2273
parent.
Nodes
.Add(node2);
2274
parent.
Nodes
.Add(node3);
2275
node3.
Nodes
.Add(node4);
2292
parent.
Nodes
.Add(node1);
2293
parent.
Nodes
.Add(node2);
2294
parent.
Nodes
.Add(node3);
2295
node3.
Nodes
.Add(node4);
2314
parent.
Nodes
.Add(node1);
2315
parent.
Nodes
.Add(node2);
2316
parent.
Nodes
.Add(node3);
2317
node3.
Nodes
.Add(node4);
2444
parent.
Nodes
.Add(node1);
2445
parent.
Nodes
.Add(node2);
2446
parent.
Nodes
.Add(node3);
2447
node3.
Nodes
.Add(node4);
2464
parent.
Nodes
.Add(node1);
2465
parent.
Nodes
.Add(node2);
2466
parent.
Nodes
.Add(node3);
2467
node3.
Nodes
.Add(node4);
2486
parent.
Nodes
.Add(node1);
2487
parent.
Nodes
.Add(node2);
2488
parent.
Nodes
.Add(node3);
2489
node3.
Nodes
.Add(node4);
2548
parent.
Nodes
.Add(node1);
2549
parent.
Nodes
.Add(node2);
2550
parent.
Nodes
.Add(node3);
2551
node3.
Nodes
.Add(node4);
2568
parent.
Nodes
.Add(node1);
2569
parent.
Nodes
.Add(node2);
2570
parent.
Nodes
.Add(node3);
2571
node3.
Nodes
.Add(node4);
2590
parent.
Nodes
.Add(node1);
2591
parent.
Nodes
.Add(node2);
2592
parent.
Nodes
.Add(node3);
2593
node3.
Nodes
.Add(node4);
2665
parent.
Nodes
.Add(node1);
2666
parent.
Nodes
.Add(node2);
2667
parent.
Nodes
.Add(node3);
2668
node3.
Nodes
.Add(node4);
2685
parent.
Nodes
.Add(node1);
2686
parent.
Nodes
.Add(node2);
2687
parent.
Nodes
.Add(node3);
2688
node3.
Nodes
.Add(node4);
2707
parent.
Nodes
.Add(node1);
2708
parent.
Nodes
.Add(node2);
2709
parent.
Nodes
.Add(node3);
2710
node3.
Nodes
.Add(node4);
4542
parent.
Nodes
.Add(node1);
4543
parent.
Nodes
.Add(node2);
4544
parent.
Nodes
.Add(node3);
4545
node3.
Nodes
.Add(node4);
4562
parent.
Nodes
.Add(node1);
4563
parent.
Nodes
.Add(node2);
4564
parent.
Nodes
.Add(node3);
4565
node3.
Nodes
.Add(node4);
4584
parent.
Nodes
.Add(node1);
4585
parent.
Nodes
.Add(node2);
4586
parent.
Nodes
.Add(node3);
4587
node3.
Nodes
.Add(node4);
4613
subNodeLevel2.
Nodes
.Add(subNodeLevel3);
4614
subNodeLevel1.
Nodes
.Add(subNodeLevel2);
4615
rootNode.
Nodes
.Add(subNodeLevel1);
4629
treeNode.
Nodes
.Add(treeSubNode);
4723
treeNode.
Nodes
.Add(new TreeNode(childNode1));
4724
treeNode.
Nodes
.Add(new TreeNode(childNode2));
4729
clonedNode.
Nodes
.Count.Should().Be(treeNode.
Nodes
.Count);
4730
clonedNode.
Nodes
[0].Text.Should().Be(treeNode.
Nodes
[0].Text);
4731
clonedNode.
Nodes
[1].Text.Should().Be(treeNode.
Nodes
[1].Text);
4778
node.
Nodes
.Add(CreateTreeNodeStructure(depth - 1, breadth, initiallyExpanded));
4793
foreach (TreeNode child in node.
Nodes
)
4832
child.
Nodes
.Add(new TreeNode());
4833
node.
Nodes
.Add(child);
System\Windows\Forms\TreeViewTests.cs (122)
4745
Assert.Throws<ArgumentException>(() => node.
Nodes
.Add(node));
6693
treeNode.
Nodes
.Add(treeSubNodeLevel1);
6694
treeSubNodeLevel1.
Nodes
.Add(treeSubNodeLevel2);
6713
treeNode.
Nodes
.Add(treeSubNodeLevel1);
6714
treeSubNodeLevel1.
Nodes
.Add(treeSubNodeLevel2);
6752
treeNode.
Nodes
.Add(treeSubNodeLevel1);
6753
treeSubNodeLevel1.
Nodes
.Add(treeSubNodeLevel2);
6792
treeNode.
Nodes
.Add(treeSubNodeLevel1);
6793
treeSubNodeLevel1.
Nodes
.Add(treeSubNodeLevel2);
6896
treeNode.
Nodes
.AddRange([new("Test 1"), new("Test 2"), new("Test 3")]);
6898
treeView.SelectedNode = treeNode.
Nodes
[0];
6900
Assert.True(treeNode.
Nodes
[0].IsSelected);
6901
Assert.Equal(3, treeNode.
Nodes
.Count);
6902
Assert.Equal(treeNode.
Nodes
[0], treeView.SelectedNode);
6904
treeNode.
Nodes
.Remove(treeNode.
Nodes
[2]);
6906
Assert.True(treeNode.
Nodes
[0].IsSelected);
6907
Assert.Equal(2, treeNode.
Nodes
.Count);
6908
Assert.Equal(treeNode.
Nodes
[0], treeView.SelectedNode);
6910
treeNode.
Nodes
.Remove(treeNode.
Nodes
[1]);
6912
Assert.True(treeNode.
Nodes
[0].IsSelected);
6913
Assert.Single(treeNode.
Nodes
);
6914
Assert.Equal(treeNode.
Nodes
[0], treeView.SelectedNode);
6925
treeNode.
Nodes
.AddRange([new("Test 1"), new("Test 2"), new("Test 3")]);
6927
treeView.SelectedNode = treeNode.
Nodes
[0];
6929
for (int count = treeNode.
Nodes
.Count; count > 1; count -= 1)
6931
TreeNode node = treeNode.
Nodes
[0];
6934
Assert.Equal(count, treeNode.
Nodes
.Count);
6941
Assert.Equal(count, treeNode.
Nodes
.Count);
6949
Assert.Equal(treeNode.
Nodes
[0], treeView.SelectedNode);
6962
treeNode.
Nodes
.Add("Test 1");
6964
treeView.SelectedNode = treeNode.
Nodes
[0];
6966
Assert.True(treeNode.
Nodes
[0].IsSelected);
6967
Assert.Equal(treeNode.
Nodes
[0], treeView.SelectedNode);
6968
Assert.Single(treeNode.
Nodes
);
6973
Assert.False(treeNode.
Nodes
[0].IsSelected);
7038
treeNode.
Nodes
.AddRange([new("Test 1"), new("Test 2"), new("Test 3")]);
7040
treeNode.
Nodes
[0].Checked = true;
7042
Assert.True(treeNode.
Nodes
[0].Checked);
7043
Assert.Equal(3, treeNode.
Nodes
.Count);
7045
treeNode.
Nodes
.Remove(treeNode.
Nodes
[2]);
7047
Assert.True(treeNode.
Nodes
[0].Checked);
7048
Assert.Equal(2, treeNode.
Nodes
.Count);
7050
treeNode.
Nodes
.Remove(treeNode.
Nodes
[1]);
7052
Assert.True(treeNode.
Nodes
[0].Checked);
7053
Assert.Single(treeNode.
Nodes
);
7066
treeNode.
Nodes
.AddRange([new("Test 1"), new("Test 2"), new("Test 3")]);
7068
for (int count = treeNode.
Nodes
.Count; count > 1; count -= 1)
7070
TreeNode node = treeNode.
Nodes
[0];
7074
Assert.Equal(count, treeNode.
Nodes
.Count);
7080
Assert.Equal(count, treeNode.
Nodes
.Count);
7094
treeNode.
Nodes
.Add("Test 1");
7097
treeNode.
Nodes
[0].Checked = true;
7100
Assert.True(treeNode.
Nodes
[0].Checked);
7101
Assert.Single(treeNode.
Nodes
);
7107
Assert.True(treeNode.
Nodes
[0].Checked);
7108
Assert.Single(treeNode.
Nodes
);
7118
treeView.Nodes[0].
Nodes
.Add("Child 1");
7119
treeView.Nodes[0].
Nodes
.Add("Child 2");
7122
treeView.Nodes[1].
Nodes
.Add("Child 3");
7123
treeView.Nodes[1].
Nodes
.Add("Child 4");
7149
parent.
Nodes
.Add(firstNode);
7151
parent.
Nodes
.Add(secondNode);
7155
Action action = parent.
Nodes
.Clear;
7172
parent.
Nodes
.Add(firstNode);
7174
parent.
Nodes
.Add(secondNode);
7178
parent.
Nodes
.Remove(firstNode);
7180
Action action = () => parent.
Nodes
.Remove(secondNode);
7200
parent.
Nodes
.AddRange([treeNode8]);
7204
Assert.Single(treeNode5.
Nodes
);
7206
parent.
Nodes
.Remove(treeNode4);
7207
Assert.Empty(treeNode5.
Nodes
);
7211
parent.
Nodes
.Remove(treeNode5);
7212
parent.
Nodes
.Remove(treeNode6);
7213
parent.
Nodes
.Remove(treeNode7);
7214
parent.
Nodes
.Remove(treeNode8);
7239
parent.
Nodes
.AddRange([firstSubNode]);
7242
Assert.Equal(3, fifthSubNode1.
Nodes
.Count);
7243
Assert.Equal(2, parent.
Nodes
[0].
Nodes
.Count);
7244
Assert.Single(parent.
Nodes
);
7245
Assert.Equal(fourthSubNode2, thirdSubNode1.
Nodes
[0]);
7246
Assert.Equal(lastSubNode3, fifthSubNode1.
Nodes
[1]);
7251
Assert.Equal(fourthSubNode2, thirdSubNode1.
Nodes
[1]);
7252
Assert.Equal(lastSubNode3, fifthSubNode1.
Nodes
[2]);
7255
fifthSubNode1.
Nodes
.Clear();
7256
Assert.Empty(fifthSubNode1.
Nodes
);
7259
firstSubNode.
Nodes
.Clear();
7260
Assert.Empty(firstSubNode.
Nodes
);
7263
Action action = parent.
Nodes
.Clear;
7265
Assert.Empty(parent.
Nodes
);
7278
parent.
Nodes
.Add("Node1", "Node1");
7284
Assert.Equal(treeNode3, parent.
Nodes
[3]);
7286
parent.
Nodes
.Remove(treeNode3);
7287
Assert.Equal(4, parent.
Nodes
.Count);
7288
Assert.Equal(treeNode4, parent.
Nodes
[3]);
7291
Assert.True(parent.
Nodes
.ContainsKey("Node1"));
7293
parent.
Nodes
.RemoveByKey("Node1");
7294
Assert.False(parent.
Nodes
.ContainsKey("Node1"));
7295
Assert.Equal(treeNode1, parent.
Nodes
[0]);
7298
parent.
Nodes
.Remove(parent.
Nodes
[0]);
7299
Assert.Equal(2, parent.
Nodes
.Count);
7300
Assert.Equal(treeNode2, parent.
Nodes
[0]);
7303
parent.
Nodes
.Remove(parent.
Nodes
[1]);
7304
Assert.Single(parent.
Nodes
);
7305
Assert.Equal(treeNode2, parent.
Nodes
[0]);
7326
rootNode.
Nodes
.AddRange(treeNode1, treeNode2, treeNode3, treeNode4, treeNode5, treeNode6, treeNode7);
7331
TreeNode childNode1 = rootNode.
Nodes
[0];
7332
TreeNode childNode2 = rootNode.
Nodes
[1];
7333
TreeNode childNode3 = rootNode.
Nodes
[2];
7334
TreeNode childNode4 = rootNode.
Nodes
[3];
7335
TreeNode childNode5 = rootNode.
Nodes
[4];
7336
TreeNode childNode6 = rootNode.
Nodes
[5];
7337
TreeNode childNode7 = rootNode.
Nodes
[6];
7338
TreeNode childNode8 = rootNode.
Nodes
[7];
7421
rootNode.
Nodes
.Add(childNode);
7426
childNode.
Nodes
.Add(grandChildNode);