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

RadTreeView & RadDragAndDropManager

4 Answers 100 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
rubenhak
Top achievements
Rank 1
rubenhak asked on 03 Dec 2009, 10:19 PM
Hi,

I'm using a RadTreeView with IsDragDropEnabled ="True" and need to limit dragging and dropping for certain items. Tried to attach to 
            RadDragAndDropManager.AddDragQueryHandler(...); 
            RadDragAndDropManager.AddDragInfoHandler(...); 
            RadDragAndDropManager.AddDropQueryHandler(..); 
            RadDragAndDropManager.AddDropInfoHandler(...); 
 
and manipulate with e.QueryResult but it does not take any effect. All the items are allowed to be dragged and dropped anywhere inside the treeview. 

I followed the sample and it does work for the GridView but doesn't on a TreeView.

Thanks,
Ruben.

4 Answers, 1 is accepted

Sort by
0
Valentin.Stoychev
Telerik team
answered on 04 Dec 2009, 11:41 AM
Hello rubenhak,

Please check this help article:
http://www.telerik.com/help/silverlight/radtreeview-features-drag-and-drop.html

This article can also be of help:
http://www.telerik.com/help/silverlight/raddraganddrop-events.html

Please let us know if you need more help.

Best wishes,
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
rubenhak
Top achievements
Rank 1
answered on 04 Dec 2009, 09:03 PM
Hi Valentin,

Thanks for the articles. It gives a better idea how does dragging and dropping implemented. However, still not clear how to control disallowing dropping on certain items on the treeview. It works fine when dragging from RadGridView to RadTreeView. When dragging/dropping inside a TreeView, the DropQuery event is not being fired at all.

Thanks,
Ruben.
0
Accepted
Kiril Stanoev
Telerik team
answered on 08 Dec 2009, 02:04 PM
Hi Ruben,

The message from the DropQuery event is handled by RadTreeView. Therefore, to receive the DropQuery event, you will have to subscribe for handled events too:

public MainPage()
{
    InitializeComponent();
    treeView1.AddHandler(RadDragAndDropManager.DropQueryEvent, new EventHandler<DragDropQueryEventArgs>(DragDropQueryEventHandler), true);
}
 
private void DragDropQueryEventHandler(object sender, DragDropQueryEventArgs e)
{
    // add your custom logic here
}

The last parameter in treeView1.AddHandler allows you to listen for handled events. An important note is to add using Telerik.Windows; in your usings section.

Give it a try and let me know how it works for you.


All the best,
Kiril Stanoev
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
rubenhak
Top achievements
Rank 1
answered on 08 Dec 2009, 06:30 PM
Hi Kiril.

Yes, it works. 

Thanks,
Ruben
Tags
TreeView
Asked by
rubenhak
Top achievements
Rank 1
Answers by
Valentin.Stoychev
Telerik team
rubenhak
Top achievements
Rank 1
Kiril Stanoev
Telerik team
Share this question
or