I'm trying to implement a filter on a treeview but it doesn't work.
Here is what I do:
1. Get a TreeGrapgh collection over WCF. it is a Collection<Node> where node
looks like:
class Branch
{
string Name { get; set; }
NodeCollection Children;
}
class BranchCollection : Collection<Branch>
{
}
Then I create a temple in XAML that uses a HierarchicalDataTemplate:
in C# code I bind is to ItemSource:
_branchTree = e.Result as BranchTransportCollection;
RADTreeView.Items.Clear();
RADTreeView.ItemsSource = _branchTree;
After that on TextChange even on my text box I do this
Here is what I do:
1. Get a TreeGrapgh collection over WCF. it is a Collection<Node> where node
looks like:
class Branch
{
string Name { get; set; }
NodeCollection Children;
}
class BranchCollection : Collection<Branch>
{
}
Then I create a temple in XAML that uses a HierarchicalDataTemplate:
<TelerikWindowsControls:HierarchicalDataTemplate x:Key="BranchTreeTemplate" ItemsSource="{Binding Children}">
<TextBlock HorizontalAlignment="Left" Text="{Binding Name}" AutomationProperties.Name="{Binding Name}" />
</TelerikWindowsControls:HierarchicalDataTemplate>
in C# code I bind is to ItemSource:
_branchTree = e.Result as BranchTransportCollection;
RADTreeView.Items.Clear();
RADTreeView.ItemsSource = _branchTree;
After that on TextChange even on my text box I do this
var fl = _branchTree.Where(b => b.Name.IndexOf(_filterText) > -1);
RADTreeView.ItemsSource = null;
RADTreeView.ItemsSource = fl;
but this doesn't work as expected. the branches are not filtered, I think I get more branches not less.
I'm confused here. Please help