2 posts, 0 answers
  1. David
    David avatar
    27 posts
    Member since:
    Apr 2013

    Posted 26 Jun 2013 Link to this post

    I have tried everything I can think of and I can not get the nodes in my RadTreeView sorted alphabetically. I am using Hierarchical data binding and my tree is heterogeneous, but all of the objects have a Name property which is what I want to sort on. The most promising approach seemed to be using a CollectionViewSource but this is not working (note the tree view and all children show up fine, just not sorted).

    The XAML for my CollectionViewSource is

    <CollectionViewSource x:Key="ManagerView">
            <cm:SortDescription Direction="Ascending" PropertyName="Name"/>

    My RadTreeView is

    <telerik:RadTreeView x:Name="ManagerTreeView" Grid.Row="1" Grid.Column="0" ItemsSource="{Binding Source={StaticResource ManagerView}}"/>

    And the code behind to connect the CollectionViewSource to my data is 

    CollectionViewSource cvs = this.TopLevelGrid.Resources["ManagerView"] as CollectionViewSource;
    cvs.Source = RemoteWorkspace.Instance.RemoteManager;

    Note that the tree shows up, all the objects are there, they are simply not sorted.

    I have resorted to sorting the collections in my application code, but this seems less desirable.

    Is there a way to sort the items in a RadTreeView that uses data binding.

    Also note that all of my data is stored in ObservableCollections because the content is dynamic (i.e. RemoteWorkspace.Instance.RemoteManager refers to an ObservableCollection). Not sure if this makes a difference or not.

  2. Pavel R. Pavlov
    Pavel R. Pavlov avatar
    1165 posts

    Posted 01 Jul 2013 Link to this post

    Hi David,

    Our RadTreeView control is designed to display large amount of hierarchical data and it does not support sorting, filtering and searching out of the box. In order to achieve such functionality you have to apply there operations on the ItemsSource collection of the RadTreeView control. The CollectionViewSource can do the the sorting and filtering.

    However, as I can't be sure about your implementation I can not make suggestion about our scenario. Basically the ItemsSource of the RadTreeView control can be set to a CollectionViewSource and the sorting functionality works as expected.

    Please take a look at the attached project and see if it works for you. If you still can reproduce your issue, please change the project so that the issue can be reproduced in it and sent it over. By doing this we will be able to fully understand your scenario and make a suggestion after further investigation.

    Thank you for your kind cooperation.

    Pavel R. Pavlov
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. DevCraft R3 2016 release webinar banner
Back to Top