Getting Dragged RadtreeViewItems in DropQueryEvent

4 posts, 0 answers
  1. Akiono Wan
    Akiono Wan avatar
    3 posts
    Member since:
    Jan 2010

    Posted 06 Jan 2010 Link to this post

    Hello,

    I would like to evaluate wether a Drop Operation on a specfic RadtreeViewItem is allowed.
    I got a WPF Radtreeview with hierachical Data Binding, Multiselection and Drag&Drop occurs only within the Treeview.
    Therefore I added a Event Handler to the DropQuery Event of the RadTreeview.

    RadTreeView1.AddHandler(RadDragAndDropManager.DropQueryEvent, new EventHandler<DragDropQueryEventArgs>(RadTreeView_DropQuery), true); 


    For my Decision it is necessary to know which RadtreeviewItems are dragged. I don´t need the dragged data objects, because my decision is based on parent of each dragged RadtreeviewItem.

     
    private void RadTreeView_DropQuery(object sender, DragDropQueryEventArgs e) 
            { 
     
                bool dropPossible = checkIfDropPossible(draggedRadTreeViewItems); 
                
                if (dropPossible) 
                { 
                    e.QueryResult = true
                } 
                else 
                { 
                    e.QueryResult = false
                } 
    }                     


    Therefore I need a way to get the dragged RadtreeviewItems in the DropQueryEvent. I searched all e.Options members but I get the responding data objects (e.Options.Payload) only.

    How can I get corresponding dragged RadTreeViewItems to the DataObjects in the DropQueryEvent? Any help is welcome.

    Best Regards
    Akiono Wan
  2. Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 08 Jan 2010 Link to this post

    Hi Akiono Wan,

    In your case the e.Options.Payload contains the List of the items that are being dragged.

    Greetings,
    Valentin.Stoychev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Akiono Wan
    Akiono Wan avatar
    3 posts
    Member since:
    Jan 2010

    Posted 11 Jan 2010 Link to this post

    Hi Valentin Stoychev,

    thanks for your reply, but it doesn´t fit exactly to my problem.

    With e.Options.Payload I will get my own datastructure. But I need the dragged RadTreeviewItem Objects and not my own datastructure.
    Therefore I need a IEnumerable<RadtreeViewItem> draggedRadtreeviewItems.

    I solved the problem by extending my own datastructure with a parent member property, but I think nevertheless it could be a suitable requirement to get the corresponding dragged RadtreeviewItems and not the own datastructure only.

    Regards
    Akiono Wan
  5. Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 11 Jan 2010 Link to this post

    Hello Akiono Wan,

    Yes - this is by desing. To get the containr from the data item use the ItemContainerGenerator class. Check this help article:
    http://www.telerik.com/help/silverlight/radtreeview-how-to-iterate-through-treeviewitems.html

    Greetings,
    Valentin.Stoychev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top