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

TreeViewItems Drag Drop MVVM

1 Answer 74 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Kal Sir
Top achievements
Rank 1
Kal Sir asked on 17 Jun 2011, 06:16 PM
Hello,

I am using MVVM to implement my Drag and Drop in my TreeView. At the moment i am usng eventtrigger to bind my command when DragEnd event takes place. In Viewmodel, when the command calls my method, i am trying to call the appropriate service  to delete and add the Nodes (treeviewitems) in the the treeviw to its appropriate parents. But my issue is figuring out the previous and the new parent of the child/node/radtreviewitem that had been dragged and dropped. So that when i call my serivices and tell what parent child is being deleted and which parent is getting a new child. I hope i am making sense here and your help is very much appreciated.

Thank You in advace,

1 Answer, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 22 Jun 2011, 02:53 PM
Hello Kal Sir,

I think that you can structure your ViewModels to help you achieve this parent reference easier. For example you can have MainViewModel or TreeViewViewModel that holds an ObservableCollection of child TreeViewItemViewModels and the child models could have a "ParentModel" property of type TreeViewItemViewModels.
Another approach could be using the CollectionChanged event of the ObservableCollection ( you will get notified when a Insert/Remove operation is performed in the ViewModels).
Please let us know if this helped you.

Regards,
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
Kal Sir
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Share this question
or