Skip to content

Commit f8c6028

Browse files
ES-975464 - Resolve the ReadMe file length issue in this sample repository
1 parent 5a9c181 commit f8c6028

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

README.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,40 @@
11
# How to search and select the record in wpf and uwp treegrid?
2-
This example illustrates how to search and select the record in wpf and uwp treegrid
2+
3+
This example illustrates how to search and select the record in [WPF TreeGrid](https://www.syncfusion.com/wpf-controls/treegrid) and [UWP TreeGrid](https://www.syncfusion.com/uwp-ui-controls/treegrid).
4+
5+
You can search and select a record in `TreeGrid` based on the searched text using the `TextChanged` event of `TextBox`.
6+
7+
``` c#
8+
private void TextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
9+
{
10+
var textBox = sender as TextBox;
11+
var treeGrid = this.AssociatedObject.treeGrid;
12+
if (textBox.Text == "")
13+
treeGrid.SelectedItems.Clear();
14+
15+
for (int i = 0; i < treeGrid.View.Nodes.Count; i++)
16+
{
17+
if (Provider == null)
18+
Provider = treeGrid.View.GetPropertyAccessProvider();
19+
20+
if (treeGrid.View.Nodes[i].HasChildNodes && treeGrid.View.Nodes[i].ChildNodes.Count == 0)
21+
{
22+
treeGrid.BeginInit();
23+
treeGrid.ExpandNode(treeGrid.View.Nodes[i]);
24+
treeGrid.CollapseNode(treeGrid.View.Nodes[i]);
25+
treeGrid.EndInit();
26+
}
27+
else if (treeGrid.View.Nodes[i].HasChildNodes)
28+
{
29+
dataRow = (treeGrid.View.Nodes[i].Item as EmployeeInfo);
30+
FindMatchText(dataRow);
31+
GetChildNodes(treeGrid.View.Nodes[i]);
32+
}
33+
else
34+
{
35+
dataRow=(treeGrid.View.Nodes[i].Item as EmployeeInfo);
36+
FindMatchText(dataRow);
37+
}
38+
}
39+
}
40+
```

0 commit comments

Comments
 (0)