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
My RadTreeView is
And the code behind to connect the CollectionViewSource to my data is
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.
Thanks
Dave
The XAML for my CollectionViewSource is
<
CollectionViewSource
x:Key
=
"ManagerView"
>
<
CollectionViewSource.SortDescriptions
>
<
cm:SortDescription
Direction
=
"Ascending"
PropertyName
=
"Name"
/>
</
CollectionViewSource.SortDescriptions
>
</
CollectionViewSource
>
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.
Thanks
Dave