Articles in this section
Category / Section

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?

1 min read

 

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

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment