Skip to content

Commit 2ba884a

Browse files
authored
Sample added
Sample added
1 parent 328e2ca commit 2ba884a

25 files changed

+1699
-0
lines changed

Searchbytagvalue.png

29.1 KB
Loading

TreeViewAdvDemo/C#/Form1.Designer.cs

Lines changed: 239 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

TreeViewAdvDemo/C#/Form1.cs

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Data;
4+
using System.Linq;
5+
using System.Windows.Forms;
6+
using Syncfusion.Windows.Forms.Tools;
7+
8+
namespace TreeViewCustomControl
9+
{
10+
public partial class Form1 : Form
11+
{
12+
#region Constructor
13+
14+
public Form1()
15+
{
16+
InitializeComponent();
17+
this.treeViewAdv1.Nodes[0].CustomControl = this.comboBoxAdv1;
18+
this.treeViewAdv1.Nodes[2].Nodes[0].CustomControl = this.comboBoxAdv3;
19+
20+
this.treeViewAdv1.Nodes[0].Tag = "Search node";
21+
this.treeViewAdv1.Nodes[1].Tag = "Search node";
22+
this.treeViewAdv1.Nodes[2].Tag = "Search node";
23+
this.treeViewAdv1.Nodes[2].Nodes[0].Tag = "Search node";
24+
25+
//To search all nodes
26+
nodes = treeViewAdv1.SearchTree().Where(n => n.Tag == "Search node").ToList();
27+
}
28+
29+
#endregion
30+
31+
List<TreeNodeAdv> nodes;
32+
33+
private void textBox1_TextChanged(object sender, EventArgs e)
34+
{
35+
this.listBox1.Items.Clear();
36+
if (this.textBox1.Text == "Search node")
37+
{
38+
foreach (TreeNodeAdv item in nodes)
39+
{
40+
this.listBox1.Items.Add(item.Text + " :" + "Tag : " + item.Tag);
41+
}
42+
}
43+
}
44+
}
45+
46+
public static class SOExtension
47+
{
48+
public static IEnumerable<TreeNodeAdv> SearchTree(this TreeViewAdv treeView)
49+
{
50+
return SearchTree(treeView.Nodes);
51+
}
52+
53+
public static IEnumerable<TreeNodeAdv> SearchTree(this TreeNodeAdvCollection coll)
54+
{
55+
return coll.Cast<TreeNodeAdv>().Concat(coll.Cast<TreeNodeAdv>().SelectMany(x => SearchTree(x.Nodes)));
56+
}
57+
}
58+
}

0 commit comments

Comments
 (0)