Index: Core/Common/src/Core.Common.Controls.TreeView/DragDropHandler.cs =================================================================== diff -u -rb060eed93e2290dbe0a36da6e5556002625b73d5 -rae6c53b67bd2ae5e49606b31fd1575eecc58620d --- Core/Common/src/Core.Common.Controls.TreeView/DragDropHandler.cs (.../DragDropHandler.cs) (revision b060eed93e2290dbe0a36da6e5556002625b73d5) +++ Core/Common/src/Core.Common.Controls.TreeView/DragDropHandler.cs (.../DragDropHandler.cs) (revision ae6c53b67bd2ae5e49606b31fd1575eecc58620d) @@ -114,25 +114,16 @@ } var treeNodeInfo = getTreeNodeInfoForData(nodeDropTarget.Tag); + var canDrop = treeNodeInfo.CanDrop != null && treeNodeInfo.CanDrop(nodeDragging.Tag, nodeDropTarget.Tag); - DragOperations allowedOperations = treeNodeInfo.CanDrop != null - ? treeNodeInfo.CanDrop(nodeDragging.Tag, nodeDropTarget.Tag) - : DragOperations.None; + e.Effect = canDrop ? DragDropEffects.Move : DragDropEffects.None; - e.Effect = ToDragDropEffects(allowedOperations); - if (PlaceholderLocation.None == placeholderLocation) { return; } - // Determine whether or not the node can be dropped based on the allowed operations. - // A node can also be a valid drop target if it is the root item (nodeDragging.Parent == null). - var dragOperations = treeNodeInfo.CanDrop != null - ? treeNodeInfo.CanDrop(nodeDragging.Tag, nodeDropTarget.Tag) - : DragOperations.None; - - if (DragOperations.None != dragOperations) + if (canDrop) { DrawPlaceholder(treeView, nodeOver, placeholderLocation); } @@ -310,10 +301,5 @@ } return loc; } - - private DragDropEffects ToDragDropEffects(DragOperations operation) - { - return (DragDropEffects) Enum.Parse(typeof(DragDropEffects), operation.ToString()); - } } } \ No newline at end of file Index: Core/Common/src/Core.Common.Controls.TreeView/TreeNodeInfo.cs =================================================================== diff -u -rb060eed93e2290dbe0a36da6e5556002625b73d5 -rae6c53b67bd2ae5e49606b31fd1575eecc58620d --- Core/Common/src/Core.Common.Controls.TreeView/TreeNodeInfo.cs (.../TreeNodeInfo.cs) (revision b060eed93e2290dbe0a36da6e5556002625b73d5) +++ Core/Common/src/Core.Common.Controls.TreeView/TreeNodeInfo.cs (.../TreeNodeInfo.cs) (revision ae6c53b67bd2ae5e49606b31fd1575eecc58620d) @@ -139,10 +139,9 @@ /// Gets or sets a function for checking whether or not the tree node can be dropped to another location. /// The first object parameter represents the data of the tree node which is dragged. /// The second object parameter represents the data of the tree node being considered as drop target. - /// The return value indicates what operation is valid when the tree node is dropped onto the drop target. /// /// When dragging a node, the function of the of the drop target should be called. - public Func CanDrop { get; set; } + public Func CanDrop { get; set; } /// /// Gets or sets a function for checking whether or not the tree node can be inserted into the drop target at a specific index. @@ -284,10 +283,9 @@ /// Gets or sets a function for checking whether or not the tree node can be dropped to another location. /// The first object parameter represents the data of the tree node which is dragged. /// The second object parameter represents the data of the tree node being considered as drop target. - /// The return value indicates what operation is valid when the tree node is dropped onto the drop target. /// /// When dragging a node, the function of the of the drop target should be called. - public Func CanDrop { get; set; } + public Func CanDrop { get; set; } /// /// Gets or sets a function for checking whether or not the tree node can be inserted into the drop target at a specific index. @@ -361,7 +359,7 @@ : (Func) null, CanDrop = treeNodeInfo.CanDrop != null ? (draggedTag, targetTag) => treeNodeInfo.CanDrop(draggedTag, targetTag) - : (Func) null, + : (Func) null, CanInsert = treeNodeInfo.CanInsert != null ? (draggedTag, targetTag) => treeNodeInfo.CanInsert(draggedTag, targetTag) : (Func) null, Index: Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendView.cs =================================================================== diff -u -rb060eed93e2290dbe0a36da6e5556002625b73d5 -rae6c53b67bd2ae5e49606b31fd1575eecc58620d --- Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendView.cs (.../LegendView.cs) (revision b060eed93e2290dbe0a36da6e5556002625b73d5) +++ Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendView.cs (.../LegendView.cs) (revision ae6c53b67bd2ae5e49606b31fd1575eecc58620d) @@ -149,14 +149,14 @@ # region ChartDataCollection - private DragOperations BaseChartCanDrop(object draggedData, object targetData) + private bool BaseChartCanDrop(object draggedData, object targetData) { if (draggedData is ChartData) { - return DragOperations.Move; + return true; } - return DragOperations.None; + return false; } private bool BaseChartCanInsert(object draggedData, object targetData) Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartDataCollectionTreeNodeInfoTest.cs =================================================================== diff -u -rb060eed93e2290dbe0a36da6e5556002625b73d5 -rae6c53b67bd2ae5e49606b31fd1575eecc58620d --- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartDataCollectionTreeNodeInfoTest.cs (.../ChartDataCollectionTreeNodeInfoTest.cs) (revision b060eed93e2290dbe0a36da6e5556002625b73d5) +++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartDataCollectionTreeNodeInfoTest.cs (.../ChartDataCollectionTreeNodeInfoTest.cs) (revision ae6c53b67bd2ae5e49606b31fd1575eecc58620d) @@ -111,24 +111,24 @@ } [Test] - public void CanDrop_SourceNodeTagIsNoChartData_ReturnsDragOperationsNone() + public void CanDrop_SourceNodeTagIsNoChartData_ReturnsFalse() { // Setup var chartDataCollection = mocks.StrictMock(new List()); mocks.ReplayAll(); // Call - var validOperations = info.CanDrop(new object(), chartDataCollection); + var canDrop = info.CanDrop(new object(), chartDataCollection); // Assert - Assert.AreEqual(DragOperations.None, validOperations); + Assert.IsFalse(canDrop); mocks.VerifyAll(); } [Test] - public void CanDrop_SourceNodeTagIsChartData_ReturnsDragOperationsMove() + public void CanDrop_SourceNodeTagIsChartData_ReturnsTrue() { // Setup var chartData = mocks.StrictMock(); @@ -137,16 +137,16 @@ mocks.ReplayAll(); // Call - var validOperations = info.CanDrop(chartData, chartDataCollection); + var canDrop = info.CanDrop(chartData, chartDataCollection); // Assert - Assert.AreEqual(DragOperations.Move, validOperations); + Assert.IsTrue(canDrop); mocks.VerifyAll(); } [Test] - public void CanDrop_SourceNodeTagIsNoChartData_ReturnsFalse() + public void CanInsert_SourceNodeTagIsNoChartData_ReturnsFalse() { // Setup var chartDataCollection = mocks.StrictMock(new List()); @@ -163,7 +163,7 @@ } [Test] - public void CanDrop_SourceNodeTagIsChartData_ReturnsTrue() + public void CanInsert_SourceNodeTagIsChartData_ReturnsTrue() { // Setup var chartData = mocks.StrictMock(); Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs =================================================================== diff -u -rb060eed93e2290dbe0a36da6e5556002625b73d5 -rae6c53b67bd2ae5e49606b31fd1575eecc58620d --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision b060eed93e2290dbe0a36da6e5556002625b73d5) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision ae6c53b67bd2ae5e49606b31fd1575eecc58620d) @@ -702,14 +702,14 @@ return true; } - private DragOperations PipingCalculationGroupContextCanDrop(object draggedData, object targetData) + private bool PipingCalculationGroupContextCanDrop(object draggedData, object targetData) { if (GetAsIPipingCalculationItem(draggedData) != null && NodesHaveSameParentFailureMechanism(draggedData, targetData)) { - return DragOperations.Move; + return true; } - return DragOperations.None; + return false; } private static IPipingCalculationItem GetAsIPipingCalculationItem(object item) Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -rb060eed93e2290dbe0a36da6e5556002625b73d5 -rae6c53b67bd2ae5e49606b31fd1575eecc58620d --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs (.../PipingCalculationGroupContextTreeNodeInfoTest.cs) (revision b060eed93e2290dbe0a36da6e5556002625b73d5) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs (.../PipingCalculationGroupContextTreeNodeInfoTest.cs) (revision ae6c53b67bd2ae5e49606b31fd1575eecc58620d) @@ -139,10 +139,10 @@ { case DragDropTestMethod.CanDrop: // Call - DragOperations supportedOperations = info.CanDrop(draggedItemContext, targetGroupContext); + var canDrop = info.CanDrop(draggedItemContext, targetGroupContext); // Assert - Assert.AreEqual(DragOperations.Move, supportedOperations); + Assert.IsTrue(canDrop); break; case DragDropTestMethod.CanInsert: // Call @@ -185,10 +185,10 @@ { case DragDropTestMethod.CanDrop: // Call - DragOperations supportedOperations = info.CanDrop(draggedItemContext, targetGroupContext); + var canDrop = info.CanDrop(draggedItemContext, targetGroupContext); // Assert - Assert.AreEqual(DragOperations.None, supportedOperations); + Assert.IsFalse(canDrop); break; case DragDropTestMethod.CanInsert: // Call