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.
Unfortunately, activation email could not send to your email. Please try again.

GroupView drag and drop

Thread ID:

Created:

Updated:

Platform:

Replies:

88427 Jul 22,2009 11:19 AM Aug 10,2009 03:08 AM ASP.NET Web Forms (Classic) 1
loading
Tags: Tools
Scott Swartz
Asked On July 22, 2009 11:19 AM

I need to be able to support dragging and dropping an item in a GroupView onto another control. Both examples in the documentation appear to demostrate how you would drop something on a GroupView rather than dragging something from the GroupView.

Specifically, I can't figure out how to initiate the drag within the GroupView. For a TreeView I would simply trap the ItemDrag event. For a ListBox I would trap the MouseDown event and use the IndexFromPoint(e.X, e.Y) method to determine which item was being dragged.

How do I initiate the drag for a GroupViewItem?


Mano J [Syncfusion]
Replied On August 10, 2009 03:08 AM

Hi Scott,

Please check the code snippet below to drag a GroupViewItem and drop into a TreeView.


this.groupView1.AllowDragDrop = true;
this.treeView1.AllowDrop = true;

private void treeView1_DragEnter(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.Move;
}

private void treeView1_DragDrop(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent("GroupViewItemDataFormat"))
{
object data = e.Data.GetData("GroupViewItemDataFormat");
if (data != null)
{
treeView1.Nodes.Add(((GroupViewItem)data).Text);
}
}
}


Please let me know if you have any questions.

Best Regards,
Mano

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.

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.

;