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

Getting Dragged RadtreeViewItems in DropQueryEvent

3 Answers 75 Views
DragAndDrop
This is a migrated thread and some comments may be shown as answers.
Akiono Wan
Top achievements
Rank 1
Akiono Wan asked on 06 Jan 2010, 09:03 AM
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

3 Answers, 1 is accepted

Sort by
0
Valentin.Stoychev
Telerik team
answered on 08 Jan 2010, 02:15 PM
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.
0
Akiono Wan
Top achievements
Rank 1
answered on 11 Jan 2010, 08:46 AM
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
0
Valentin.Stoychev
Telerik team
answered on 11 Jan 2010, 09:42 AM
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.
Tags
DragAndDrop
Asked by
Akiono Wan
Top achievements
Rank 1
Answers by
Valentin.Stoychev
Telerik team
Akiono Wan
Top achievements
Rank 1
Share this question
or