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. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Drag & Drop from TreeViewAdv to XPToolbar

Thread ID:

Created:

Updated:

Platform:

Replies:

25910 Mar 9,2005 05:03 PM UTC Mar 10,2005 07:53 PM UTC WinForms 1
loading
Tags: Tools
Jonathan Scolamiero
Asked On March 9, 2005 05:03 PM UTC

Hi All, I am currently attempting to do the above. Does anyone have any experience attempting this? It seems as though the DragOver and DragDrop events on my XPToolbar aren''t firing, however the DragEnter event does fire. Any information/advice would be greatly appreciated. Sincerely, Jon

Administrator [Syncfusion]
Replied On March 10, 2005 07:53 PM UTC

Hi Jon, The XPToolBar’s DragDrop event does not get fired as expected (defect# 93) and this seems to be a shortcoming in our XPToolBar control. To workaround this issue, derive from our XPToolBar to create a CustomXPToolBar control (and a CustomDragDrop event handler) as shown below : public class CustomXPToolBar : XPToolBar { public CustomXPToolBar () : base() {} public event DragEventHandler CustomDragDrop; protected override void OnDragDrop(System.Windows.Forms.DragEventArgs e) { if(this.CustomDragDrop != null) this.CustomDragDrop(this, e); } } Now handle the XPToolBar’s DragEnter, CustomDragDrop events and TreeViewAdv’s MouseDown events as shown below : private void xpToolBar1_DragEnter(object sender, System.Windows.Forms.DragEventArgs e) { Console.WriteLine ("XPToolBar Drag Enter"); if (e.Data.GetDataPresent(typeof(TreeNodeAdv))) e.Effect = DragDropEffects.Copy; else e.Effect = DragDropEffects.None; } private void xpToolBar1_CustomDragDrop(object sender, System.Windows.Forms.DragEventArgs e) { Console.WriteLine ("XPToolBar Drag Drop"); if (e.Data.GetDataPresent(typeof(TreeNodeAdv))) { TreeNodeAdv node = e.Data.GetData(typeof(TreeNodeAdv)) as TreeNodeAdv; BarItem bitem = new BarItem(node.Text); this.xpToolBar1.Items.Add(bitem); } } private void treeViewAdv1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { if (e.Button == MouseButtons.Left) { // get the point where the mouse was left clicked Point p = this.treeViewAdv1.PointToClient(Control.MousePosition); // get the node at the left click point TreeNodeAdv node = this.treeViewAdv1.PointToNode(p); DoDragDrop(node, DragDropEffects.Copy); } } The complete sample illustrating the above is attached here. Please refer to it and let me know if you need further assistance. Regards, Guru Patwal Syncfusion, Inc.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;