c# wpf treeView return list of all nodes / Рекурсивный перебор элементов
- private void PrintRecursive(TreeNode treeNode)
- {
- // Print the node.
- System.Diagnostics.Debug.WriteLine(treeNode.Text);
- MessageBox.Show(treeNode.Text);
- // Print each node recursively.
- foreach (TreeNode tn in treeNode.Nodes)
- {
- PrintRecursive(tn);
- }
- }
-
- // Call the procedure using the TreeView.
- private void CallRecursive(TreeView treeView)
- {
- // Print each node recursively.
- TreeNodeCollection nodes = treeView.Nodes;
- foreach (TreeNode n in nodes)
- {
- PrintRecursive(n);
- }
- }
No comments:
Post a Comment
Note: only a member of this blog may post a comment.