Filter Treeview Items by RadDataFilter (urgent) plz

4 posts, 0 answers
  1. Yak
    Yak avatar
    4 posts
    Member since:
    May 2012

    Posted 09 Aug 2012 Link to this post

    I have RadTreeview and DataFilter By the RadDataFilter how we can do this 
    I am attaching one File about it...please help me urgent....
  2. Mike
    Mike avatar
    79 posts
    Member since:
    Nov 2011

    Posted 21 Aug 2014 in reply to Yak Link to this post


    Is there any solution for this use case? 

    Thanks for your help
  3. Mike
    Mike avatar
    79 posts
    Member since:
    Nov 2011

    Posted 21 Aug 2014 Link to this post

    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?
  4. Dimitrina
    Dimitrina avatar
    3769 posts

    Posted 22 Aug 2014 Link to this post


    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.

    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.
Back to Top