We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Drag And Drop from Syncfusion Treeview to Syncfusion Treeview

The examples I''ve seen on your website all seem to describe dragging and dropping between a Microsoft treeview control and a syncfusion control. My question is what would the code look like in the DragDrop Event if I was dragging a node from a syncfusion tree to another syncfusion tree and all I wanted to do was insert a new node in the treeview WITHOUT deleting/moving the node in the original treeview. I want the new node to have the EXACT same label as the original node and cannot figure out how to access the text value of the original node. Here is a snippet of code within the DragDrop event (taken from your examples).It does not seem to work except if you are dropping the new node onto a Microsoft treeview control. The value of e is always null in the treeview. Here is the code for the tree which is receiving the new node: Take a look at my dragdrop and comment on what is wrong: private void tvLeads_DragDrop(object sender, System.Windows.Forms.DragEventArgs e) { TreeViewAdv treeViewAdv = sender as TreeViewAdv; Point ptInTreeadv = treeViewAdv.PointToClient(new Point(e.X, e.Y)); TreeNodeAdv destinationNodeAdv = treeViewAdv.GetNodeAtPoint(ptInTreeadv); TreeNode sourcenode = e.Data.GetData(typeof(System.Windows.Forms.TreeNode))as TreeNode; TreeNodeAdv dragnode = new TreeNodeAdv(); dragnode.Text = sourcenode.Text; destinationNodeAdv.Nodes.Add(dragnode); destinationNodeAdv.Expand(); }

1 Reply

DT Deepa TS Syncfusion Team October 19, 2005 11:30 AM UTC

Hi timjax, Please take a look at this sample which reproduces your problem.. tree drag drop And let me know if this meets your requirement. Thanks for your interest in Syncfusion products Thanks for your patience. Regards, Deepa.T.S

Loader.
Live Chat Icon For mobile
Up arrow icon