TreeViewItems Drag Drop MVVM

2 posts, 0 answers
  1. Kal Sir
    Kal Sir avatar
    5 posts
    Member since:
    Apr 2010

    Posted 17 Jun 2011 Link to this post

    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,
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 22 Jun 2011 Link to this post

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