$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
WinForms TreeView Control
Build complex navigation systems and display complex hierarchical structures
Home > WinForms UI Controls > User Manual > Create Custom Filter for Nodes in C#

Customize Filtering Nodes of KetticTreeView in C#.NET

The Kettic TreeView control offers the support of filtering nodes and rich C# API for the developers to operate the data. It is really easy to perform the filtering node operations on the fly when you exposed the filtering event. The rich C# API and complete set of events provided within the KetticTreeView component help the interface designer to fully control the filtering functionalities. Developers can easily add, delete, update items at runtime, as well as simply create hierarchical navigation for KetticTreeView nodes.

Create Custom Filtering Nodes in KetticTreeView in C#.NET

KetticTreeView control for WinForms provides large flexibility for the developers to customize the filtering nodes by using their own custom logic. And the custom filtering nodes provides higher priority than the applied FilterDescriptors. The following C# code sample shows how to customize the filtering for nodes in KetticTreeView.

Create Predicate for Applying Custom Filtering to Nodes

Before we are going to add the custom logic to filtering nodes in KetticTreeView, we need to create a Predicate, which is capable of returning the nodes whose text is more than one character. The following C# code snippet shows how to achieve this.

private bool FilterNode(KetticTreeNode node)
if (node.Text.Length > 1)
return true;

return false;

Apply the Predicate to KetticTreeView in C#.NET

After we create the Predicate, we can set the FilterPredicate property of the control to apply the Predicate to the KetticTreeView. The C# code below shows how to achieve this.

ketticTreeView1.TreeViewElement.FilterPredicate = FilterNode;

C# Invoke the Filtering for KetticTreeView Nodes

Now, we shall set the Filter property of the KetticTreeView to apply the filter to the control. We can add any string to the Filter property to invoke the filtering operation with the C# code sinppet.

private void ketticButton1_Click(object sender, EventArgs e)
this.ketticTreeView1.Filter = "Custom";
UI Controlsfor Windows Forms
.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls