private void xMapActivityGroupToTestCaseGrid_DragOver(object sender, DragEventArgs e) { ucGrid r = (ucGrid)sender; if (sender is ucGrid && (sender as ucGrid).Name == xMapActivityGroupToTestCaseGrid.Name) { var obj = DragDrop2.GetGridItemHit(xMapActivityGroupToTestCaseGrid); if (obj is ALMTestCaseManualMappingConfig && (obj as ALMTestCaseManualMappingConfig).activitiesGroup != null) { int selectedIndex = xMapActivityGroupToTestCaseGrid.DataSourceList.IndexOf((obj as ALMTestCaseManualMappingConfig)); xMapActivityGroupToTestCaseGrid.Drop -= xUnMapTestCaseGrid_ItemDropped; } } }
private void xUnMapTestCaseGrid_ItemDropped(object sender, EventArgs e) { object draggedItem = ((DragInfo)sender).Data as object; if (draggedItem == null) { return; } // Get Drop Item Data var dropItem = DragDrop2.GetGridItemHit(xMapActivityGroupToTestCaseGrid); int targetIndex = GetItemIndex(xMapActivityGroupToTestCaseGrid, dropItem as ALMTestCaseManualMappingConfig); // Drag item from Mapped grid. if (draggedItem is ALMTestCaseManualMappingConfig) { if ((draggedItem as ALMTestCaseManualMappingConfig).aLMTSTest is null) { return; } int sourceIndex = GetItemIndex(xMapActivityGroupToTestCaseGrid, draggedItem); // Drag Source & Target is Mapped Grid items. if (((DragInfo)sender).DragSource == ((DragInfo)sender).DragTarget) { // Drag & Drop to same row. if (sourceIndex == targetIndex) { return; } ReplaceMappedTestCaseHandler(draggedItem as ALMTestCaseManualMappingConfig, dropItem as ALMTestCaseManualMappingConfig); } // Drag from Mapped grid to UnMapped Grid items. else { UnMapTestCaseHandler(draggedItem as ALMTestCaseManualMappingConfig); } } // Source item is from UnMapped Grid. if (draggedItem is ALMTSTest) { MapTestCaseHandler(draggedItem as ALMTSTest, (ALMTestCaseManualMappingConfig)xMapActivityGroupToTestCaseGrid.DataSourceList[targetIndex]); } }