This is a migrated thread and some comments may be shown as answers.
Filter Treeview Items by RadDataFilter (urgent) plz
3 Answers 32 Views
This is a migrated thread and some comments may be shown as answers.
Yak
Top achievements
Rank 1
Yak asked on 09 Aug 2012, 01:59 PM
I have RadTreeview and DataFilter By the RadDataFilter how we can do this 
I am attaching one File about it...please help me urgent....

3 Answers, 1 is accepted

Sort by
0
Mike
Top achievements
Rank 1
answered on 21 Aug 2014, 11:49 PM
Hello, 

Is there any solution for this use case? 

Thanks for your help
Regards
0
Mike
Top achievements
Rank 1
answered on 21 Aug 2014, 11:52 PM
This describes exactly my problem

I'm using a RadDataFilter to filter ItemSource of the RadTreeView.But when this code is exercised, the filter only applies to the Root nodes which is insufficient.Is there a way to make the filter trickle down in the hierarchy of nodes so that my predicate is called for every node ? In other words, can the filter be applied to the TreeView as a whole ?
the RadDataFilter:the Source is binding to a ObservableCollection in the ViewModel.

1.<telerik:RadDataFilter Name="radDataFilter"<br>                               telerik:StyleManager.Theme="Metro"<br>                               Grid.Row="2"<br>                               VerticalAlignment="Top"<br>                               HorizontalAlignment="Center"<br>                               MaxHeight="250"<br>                               Width="500"<br>                               BorderBrush="SkyBlue"<br>                               BorderThickness="2"<br>                               Source="{Binding SampleCollection}"<br>                               Margin="1" /></pre><br>    the RadTreeView:<br><pre lang="c#"><telerik:RadTreeView  x:Name="RadTreeView1"<br>                                     VerticalAlignment="Top"<br>                                     HorizontalAlignment="Stretch"<br>                                     Grid.Row="1"<br>                                     ToolBar.OverflowMode="Always"<br>                                     BorderBrush="SkyBlue"<br>                                     BorderThickness="2"<br>                                     MinHeight="300"<br>                                     MaxHeight="500"<br>                                     MinWidth="500"<br>                                     telerik:StyleManager.Theme="Metro"<br>                                     ItemsSource="{Binding FilteredSource,ElementName=radDataFilter}"<br>                                     ><br>            <telerik:RadTreeView.ItemTemplate><br>                <HierarchicalDataTemplate ItemsSource="{Binding Children,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"><br>                    <TextBlock x:Name="Item" Text="{Binding SampleCode}"><br>                    </TextBlock><br>                    <HierarchicalDataTemplate.Triggers><br>                        <DataTrigger Binding="{Binding IsDescribed, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Value="true"><br>                            <Setter TargetName="Item" Property="Foreground" Value="Red"/><br>                        </DataTrigger><br>                    </HierarchicalDataTemplate.Triggers><br>                </HierarchicalDataTemplate><br>            </telerik:RadTreeView.ItemTemplate><br>        </telerik:RadTreeView>



I have known that Filter is a property (not a DP) of ItemsCollection which is not DependencyObject and so DP Value inheritance isn't there.Each node in the tree has its own ItemsCollection which has its own Filter.How can i set every Node's Filter?
0
Dimitrina
Telerik team
answered on 22 Aug 2014, 01:17 PM
Hello,

The idea of RadDataFilter is to filter a collection, then you can use this filtered collection to populate your control. I tested the case and indeed,  only items on the top level are filtered.
As to filtering all the items in TreeView, I can suggest you checking the Filter search sort github example.
This example demonstrates how to implement filtering and sorting logic on the collection displayed inside the RadTreeView control. It also showcases how to implement a search functionality traversing the data displayed in the RadTreeView to find a specific item.

Although GitHub is a very well-known platform we saw a better and easier approach for reviewing our examples developing our brand new SDK Samples Browser. You can also use it to review the examples.

Let me know if this helps.

Regards,
Didie
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Asked by
Yak
Top achievements
Rank 1
Answers by
Mike
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or