You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 13, 2025. It is now read-only.
Repository navigation
This repository was archived by the owner on Oct 13, 2025. It is now read-only.
[Question] What is the best way to implement filtering of child elements in TreeDataGrid? #336
I am using TreeDataGrid to show 2 level hierarchy and I would like to implement filtering: show children that starts with user defined substring('SearchText'). Filtering should happen dynamically (while user enters search text - the amount of shown items should decrease to show only child elements that satisfy already typed text). What is the best way to implement this functionality?
I came up to a solution (not working) with defining filtering inside childSelector of HierarchicalExpanderColumn:
ItemSource=newHierarchicalTreeDataGridSource<TreeItemNode>(Items){Columns={newHierarchicalExpanderColumn<TreeItemNode>(newTextColumn<TreeItemNode,string>("Items", x =>x.Name,width:newGridLength(1,GridUnitType.Star)),
x =>x.Children?.Where(child =>string.IsNullOrEmpty(SearchText)||child.Name.StartsWith(SearchText)))}};...
internal class TreeItemNode: ObservableObject
{publicstringName{get;init;}publicIReadOnlyCollection<TreeItemNode>?Children{get;init;}publicTreeItemNode(string name,TreeItemNode[]? children =null){Name=name;Children=children;}}
However, this requires all nodes to be collapsed/expanded for recalculation, that doesn't suite my needs. Could you please suggest a better approach or a way to force TreeDataGrid to refresh it's content?
Activity