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
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?
The text was updated successfully, but these errors were encountered:
Hi.
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
: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?
The text was updated successfully, but these errors were encountered: