This is a migrated thread and some comments may be shown as answers.

Collectionviewsource to help ordering Items in treeview

3 Answers 45 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
LE DREAU Steeve
Top achievements
Rank 1
LE DREAU Steeve asked on 13 Apr 2011, 11:12 AM
Hi,

We currently have a problem using treeview, collectionviewsource and drag n drop.
We need to order our items so we have used a collectionviewsource.
But we also need drag n drop and what I saw on Internet is that we can't use drag n drop with collectionviewsource.

Do you have any solution about that please ?

Thanks

Regards

Steeve

3 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 18 Apr 2011, 04:15 PM
Hi LE DREAU Steeve,

We'll could you please elaborate more on your scenario? Why do you need CollectionViewSource and aren't you able to work with ViewModels only? I usually use CollectionViewSource for grouping Items of same type/property/parent etc. But drag and drop and item from one collection to another is allowed only if the collections are from equal type. Providing a more detailed info of your scenario would be highly appreciated and we would be able to provide with a better advice or workaround. Thank you for your cooperation.

All the best,
Petar Mladenov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
LE DREAU Steeve
Top achievements
Rank 1
answered on 26 Apr 2011, 08:25 AM
Hi,

My scenario is quite simple :
I have an object tree (with N levels of children). I would like to display this tree into a treeview. Each item must be ordrered alphabetically. So I thought I could do this with collectionviewsource (and it works but the drag n drop functionnality).
Is there any other way to do this without collectionviewsource ?

Thanks

Regards

Steeve
0
Petar Mladenov
Telerik team
answered on 29 Apr 2011, 09:50 AM
Hi LE DREAU Steeve,

Yes, you could implement grouping and sorting without using a CollectionView. You can work with ViewModels and  perform the sorting in them. When retrieving a specific level`s data you can get it sorted like so:
ObservableCollectio<Item> rootLevel = new ObservableCollection<item>(context.Categories.OrderBy(x=> x.Name));
Could you please examine this blog post and this demo and let us know if they give you an idea or you need more info?

Best wishes,
Petar Mladenov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
TreeView
Asked by
LE DREAU Steeve
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
LE DREAU Steeve
Top achievements
Rank 1
Share this question
or