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

Drag and drop with doubleclick

2 Answers 107 Views
ListView
This is a migrated thread and some comments may be shown as answers.
olivier pareige
Top achievements
Rank 1
olivier pareige asked on 16 May 2014, 04:34 PM
I try to make a drag and drop with multiple items from a radlisview to a radtreeview while keeping double click in the radlistview to open another window.
I also try with a radlistcontrol but it doesn't work. Could you help me please ?

2 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 20 May 2014, 11:46 AM
Hi Olivier,

Thank you for writing.

You can use the RadListView drag and drop service to achieve the desired functionality (which would not affect the double click). For example, you can use the PreviewDragOver and PreviewDragDrop events as follows:
void DragDropService_PreviewDragOver(object sender, Telerik.WinControls.RadDragOverEventArgs e)
{
    RadTreeViewElement el = e.HitTarget as RadTreeViewElement;
    e.CanDrop = el != null;
}
 
void DragDropService_PreviewDragDrop(object sender, Telerik.WinControls.RadDropEventArgs e)
{
    RadTreeViewElement el = e.HitTarget as RadTreeViewElement;
    if (el != null)
    {
        foreach (var item in radListView1.SelectedItems)
        {
            el.Nodes.Add(new RadTreeNode(item.Text));
 
        }
        radListView1.SelectedItems.Clear();
        
    }
}

You can subscribe to this events with the following lines of code:
radListView1.ListViewElement.DragDropService.PreviewDragDrop += DragDropService_PreviewDragDrop;
radListView1.ListViewElement.DragDropService.PreviewDragOver += DragDropService_PreviewDragOver;

Let me know if you have additional questions.
 
Regards,
Dimitar
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
olivier pareige
Top achievements
Rank 1
answered on 21 May 2014, 08:59 AM
Thank you very much, it works perfectly.
Tags
ListView
Asked by
olivier pareige
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
olivier pareige
Top achievements
Rank 1
Share this question
or