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

DragDrop events not firing

7 Answers 700 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
almir
Top achievements
Rank 1
almir asked on 08 Sep 2007, 04:54 PM
hi,

following events are not firing DragDrop, DragOver, DragEnter you will find the code below but it is trivial, all of this events are inhereted from microsoft components but still i would like them to fire.

Anyhow what I need is to check if i can drop node-draged to the one below and I need an event and possibility to change cursor or something like this. Is there a way for doing that ?

thanks

  radTreeView1.DragDrop += new DragEventHandler(radTreeView1_DragDrop);
            radTreeView1.DragEnter += new DragEventHandler(radTreeView1_DragEnter);
            radTreeView1.DragOver += new DragEventHandler(radTreeView1_DragOver);
  

void radTreeView1_DragDrop(object sender, DragEventArgs e)
        {
            Console.WriteLine("dragdrop ");
        }

        void radTreeView1_DragOver(object sender, DragEventArgs e)
        {
            Console.WriteLine("drag over");
        }

        void radTreeView1_DragEnter(object sender, DragEventArgs e)
        {
            Console.WriteLine("drag enter");

        }



7 Answers, 1 is accepted

Sort by
0
Jordan
Telerik team
answered on 10 Sep 2007, 11:41 AM
Hi almir,

The events that you mention are not supported, because they do not provide enough information on the action performed. You can use the DragEnding and DragEnded events instead of the DragDrop event.

The DragEnding event args also provide the direction (where the node is to be dropped) and allow to cancel the drag and drop operation. If I understand correctly what you want ti achieve, the DragEnding event is the one you need.

Unfortunately RadTreeView currently does not provide an "over" event, but we will be glad to work with you towards a more complete drag and drop infrastructure. Could you please share with us more details about your scenario?
Specifically we need more information about how you intend to use an "over" event.

It should be noted that RadTreeView currently supports drag and drop operations with other RadTreeView controls. We can even support drag and drop operations with any RadControl, if there is demand for this feature.

Thank you for your cooperation.
 

All the best,
Jordan
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
almir
Top achievements
Rank 1
answered on 10 Sep 2007, 12:30 PM
Hi,
what do you mean by "because they do not provide enough information on the action performed",  as much as I can remmber this events provide right place for giving visual feedback about drop destination.

my intended scenario is to cancel drag, which i can do now on drop-ending, however I can do it only after user already droped the node  (released the mouse). What I would like to achive is to give visual feedback to user, during draging (i think best place would be on over event) so that he can see that it is not allowed to drop the node here on this node. If you have some other idea how to achive this please give me a hint.

However much more important scenario for me would be, to be able to drag lines from RadGrid on the items in the tree (like draging files into new folders in windows-explorer) where I could handle the event same way like in nodes on tree

thanks for fast response
almir
0
Jordan
Telerik team
answered on 12 Sep 2007, 08:43 AM
Hi almir,

What I meant was that the drag&drop-related events in Windows Forms do not provide RadTreeView specific information like the node being dragged, or the target node.

To provide visual feedback while dragging you could use the NodeMouseEnter or NodeMouseHover events of RadTreeView.

As for your second scenario, you could try to write some custom logic in order to "convert" a RadGridView row to a RadTreeView node.
 

Greetings,
Jordan
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
almir
Top achievements
Rank 1
answered on 12 Sep 2007, 10:57 AM
Hi i will try this first scenario out for my visual feedback.

second scenario sounds good, but I have no idea where to start or how to do that, wher and how could i convert RadGridViewRow to TreeNode ?? pleas could you provide som link, how to or code snippet

thanks
0
Jordan
Telerik team
answered on 12 Sep 2007, 01:17 PM
Hi almir,

You could try implementing drag and drop from RadGridView to RadTreeView using Windows Forms drag and drop functionality. The following code shows the handlers of the events needed to implement simple drag and drop between a TextBox and RadTreeView:

void radTreeView1_DragDrop(object sender, DragEventArgs e) 
        { 
            Point p = this.radTreeView1.PointToClient(new Point(e.X, e.Y)); 
            RadTreeNode hoveredNode = this.radTreeView1.GetNodeAt(p.X, p.Y); 
             
            if (hoveredNode == null
            { 
                return
            } 
 
            hoveredNode.Nodes.Add(e.Data.GetData(DataFormats.Text).ToString()); 
        } 
 
        void radTreeView1_DragEnter(object sender, DragEventArgs e) 
        { 
            if (e.Data.GetDataPresent(DataFormats.Text)) 
            { 
                e.Effect = DragDropEffects.Copy; 
            } 
            else 
            { 
                e.Effect = DragDropEffects.None; 
            } 
        } 
 
        void textBox1_MouseDown(object sender, MouseEventArgs e) 
        { 
            if (string.IsNullOrEmpty(this.textBox1.Text)) 
            { 
                return
            } 
 
            this.textBox1.DoDragDrop(this.textBox1.Text,  
                DragDropEffects.Copy | DragDropEffects.Move); 
        } 

This should get you started.

 
Kind regards,
Jordan
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Nino
Top achievements
Rank 1
answered on 23 May 2013, 12:45 PM
Hi Guys, 

any idea why my treeview do not rise the DragEnded event? 
DragEnding works ok ...

Thanks

Nino
0
Stefan
Telerik team
answered on 28 May 2013, 07:21 AM
Hi,

Thank you for writing.

Currently, there is an issue preventing the event from firing. However, I am glad to inform you that the issue is is already resolved in our development branch and It will be included in our next release, which is expected in the middle of June.

I hope this time frame is suitable for you.
 
Regards,
Stefan
Telerik
RadChart for WinForms is obsolete. Now what?
Aravind
Top achievements
Rank 2
Iron
Iron
Iron
commented on 23 May 2023, 09:20 AM

Hi, i am using version 2017, still cant fire the dragdrop event, i need to get source and destination full path in vb.net.

Regards
Aravind
Dess | Tech Support Engineer, Principal
Telerik team
commented on 23 May 2023, 12:36 PM

Hi, Aravind,

Your question has already been answered in the other thread you have opened on the same topic. Please, see our answer there for more information.
We kindly ask you to use just one thread for a specific problem to contact us. Posting the same questions numerous times slows down our response time because we will need to review and address two or more tickets instead of one. Moreover, threads are handled according to license and time of posting, so if it is an urgent problem, we suggest you use a support ticket, which would be handled before a forum thread.

Thank you for your understanding.
Tags
Treeview
Asked by
almir
Top achievements
Rank 1
Answers by
Jordan
Telerik team
almir
Top achievements
Rank 1
Nino
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or