Drag and drop with doubleclick

3 posts, 0 answers
  1. olivier pareige
    olivier pareige avatar
    6 posts
    Member since:
    Aug 2012

    Posted 16 May 2014 Link to this post

    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. Dimitar
    Admin
    Dimitar avatar
    1411 posts

    Posted 20 May 2014 Link to this post

    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.
     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. olivier pareige
    olivier pareige avatar
    6 posts
    Member since:
    Aug 2012

    Posted 21 May 2014 in reply to Dimitar Link to this post

    Thank you very much, it works perfectly.
Back to Top