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

My application allows GroupViewItems to be dragged from the GroupView control and be dropped onto one of my custom controls. Now how do I access the GroupViewItem that is being dragged?

Platform: WinForms |
Control: GroupView |
Published Date: April 30, 2011 |
Last Revised Date: July 10, 2014

 

The GroupView control uses a custom format type for drag-and-drop. The format name is represented by the GroupView.GroupViewFormatName string constant. The GroupViewItem being dragged can be accessed by first verifying the format of the data object and, if True, using this format name to get hold of the underlying data.

The following sample shows a simple handler for the Control.DragEnter event:

C#

private void myControl1_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)

{

if(e.Data.GetDataPresent(Syncfusion.Windows.Forms.Tools.GroupView.GroupViewFormatName) == true)

{

Syncfusion.Windows.Forms.Tools.GroupViewItem item = e.Data.GetData( Syncfusion.Windows.Forms.Tools.GroupView.GroupViewFormatName ) as Syncfusion.Windows.Forms.Tools.GroupViewItem;

// Process Drag Enter

}

}

VB

Private Sub myControl1_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs)

If e.Data.GetDataPresent(Syncfusion.Windows.Forms.Tools.GroupView.GroupViewFormatName) = True Then

Dim item As Syncfusion.Windows.Forms.Tools.GroupViewItem = CType(IIf(TypeOf e.Data.GetData(Syncfusion.Windows.Forms.Tools.GroupView.GroupViewFormatName) Is Syncfusion.Windows.Forms.Tools.GroupViewItem, e.Data.GetData(Syncfusion.Windows.Forms.Tools.GroupView.GroupViewFormatName), Nothing), Syncfusion.Windows.Forms.Tools.GroupViewItem)

' Process Drag Enter

End If

End Sub

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

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