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
close icon

Drag and Drop a TreeViewItemAdv from a treeview onto a textbox

Hello,

I am trying to allow users to drop a tree node onto/into a TextBox. However, when I drag the node over the TextBox, the drop indicator changes into "can't be dropped" image and the DragEnter and DragOver events of the TextBox are not firing.

Is there anyway to allow tree nodes to have a drop target that is a TextBox?

Chad

4 Replies

DC David C Syncfusion Team June 18, 2010 12:54 PM UTC

Hi Chad,

Thanks for your interest in syncfusion products.

We can Drag the TreeViewItemAdv into TextBox."PreviewDragEnter" event of the TextBox is the best choice for that. Here we have attached the small workaround sample which illustrates this scenario. We hope it will satisfy your needs.

Please let us know if you have any queries.

Regards,
David C



TreeViewDragSample_e73041a0.zip


AD Administrator Syncfusion Team June 18, 2010 05:26 PM UTC

Thanks David,

This is very close to what I am looking for. There are two things:

1) From a visual perspective, when I drag the tree node onto the text box, the drap indicator changes to the "cannot drop" circle with a line through it. I tried setting the dragged node's AllowDrop to true in the text box's PreviewDragEnter, but the indicator remained "cannot drop".

2) Neither the PreviewDrop or the Drop event are firing for the text box.

Are there any workarounds to these two issues?

Chad


DC David C Syncfusion Team June 21, 2010 01:59 PM UTC

Hi Chad,

Thanks for your update.

1. Change the "cannot drop indicator".
You can change the appearance of the Mouse cursor by using the DragDropEffects enum. The attached sample which illustrates in detail.
2. Neither the PreviewDrop or the Drop event are firing for the text box.
TexBox will fire the Drop event only when e.Handled is equal to true on DragOver. The sample attachment explains that clearly.

Regards,
David C



TreeViewSample_81c1eb3f.zip


AD Administrator Syncfusion Team June 23, 2010 06:29 PM UTC

Perfect!

Loader.
Live Chat Icon For mobile
Up arrow icon