Index: Core/Common/src/Core.Common.Controls.TreeView/DragDropHandler.cs =================================================================== diff -u -re2e9b8f56864fad784b080c62dfb0145e0c0d4b3 -ra1de055e3698f610875e623d39f4526970568cef --- Core/Common/src/Core.Common.Controls.TreeView/DragDropHandler.cs (.../DragDropHandler.cs) (revision e2e9b8f56864fad784b080c62dfb0145e0c0d4b3) +++ Core/Common/src/Core.Common.Controls.TreeView/DragDropHandler.cs (.../DragDropHandler.cs) (revision a1de055e3698f610875e623d39f4526970568cef) @@ -151,13 +151,8 @@ var treeNodeInfo = getTreeNodeInfoForData(sourceNode.Tag); var parentTag = sourceNode.Parent != null ? sourceNode.Parent.Tag : null; - DragOperations dragOperation = treeNodeInfo.CanDrag != null - ? treeNodeInfo.CanDrag(sourceNode.Tag, parentTag) - : DragOperations.None; - - DragDropEffects effects = ToDragDropEffects(dragOperation); - - if (effects == DragDropEffects.None) + var canDrag = treeNodeInfo.CanDrag != null && treeNodeInfo.CanDrag(sourceNode.Tag, parentTag); + if (!canDrag) { return; } @@ -172,7 +167,7 @@ dataObject.SetData(sourceNode.Tag.GetType(), sourceNode.Tag); } - treeView.DoDragDrop(dataObject, effects); + treeView.DoDragDrop(dataObject, DragDropEffects.Move); } public void HandleDragLeave(FormsTreeView treeView) Index: Core/Common/src/Core.Common.Controls.TreeView/TreeNodeInfo.cs =================================================================== diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -ra1de055e3698f610875e623d39f4526970568cef --- Core/Common/src/Core.Common.Controls.TreeView/TreeNodeInfo.cs (.../TreeNodeInfo.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71) +++ Core/Common/src/Core.Common.Controls.TreeView/TreeNodeInfo.cs (.../TreeNodeInfo.cs) (revision a1de055e3698f610875e623d39f4526970568cef) @@ -133,7 +133,7 @@ /// The first object parameter represents the data of the tree node. /// The second object parameter represents the data of the parent tree node. /// - public Func CanDrag { get; set; } + public Func CanDrag { get; set; } /// /// Gets or sets a function for checking whether or not the tree node can be dropped to another location. @@ -280,7 +280,7 @@ /// The parameter represents the data of the tree node. /// The object parameter represents the data of the parent tree node. /// - public Func CanDrag { get; set; } + public Func CanDrag { get; set; } /// /// Gets or sets a function for checking whether or not the tree node can be dropped to another location. @@ -362,7 +362,7 @@ : (Action) null, CanDrag = treeNodeInfo.CanDrag != null ? (tag, parentTag) => treeNodeInfo.CanDrag((TData) tag, parentTag) - : (Func) null, + : (Func) null, CanDrop = treeNodeInfo.CanDrop != null ? (draggedTag, targetTag, dragOperations) => treeNodeInfo.CanDrop(draggedTag, targetTag, dragOperations) : (Func) null, Index: Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendView.cs =================================================================== diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -ra1de055e3698f610875e623d39f4526970568cef --- Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendView.cs (.../LegendView.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71) +++ Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendView.cs (.../LegendView.cs) (revision a1de055e3698f610875e623d39f4526970568cef) @@ -50,7 +50,7 @@ { Text = pointData => OxyPlotResources.ChartData_Point_data_label, Image = pointData => OxyPlotResources.PointsIcon, - CanDrag = (pointData, parentData) => DragOperations.Move, + CanDrag = (pointData, parentData) => true, CanCheck = pointData => true, IsChecked = pointData => pointData.IsVisible, OnNodeChecked = PointDataOnNodeChecked @@ -60,7 +60,7 @@ { Text = lineData => OxyPlotResources.ChartData_Line_data_label, Image = lineData => OxyPlotResources.LineIcon, - CanDrag = (lineData, parentData) => DragOperations.Move, + CanDrag = (lineData, parentData) => true, CanCheck = lineData => true, IsChecked = lineData => lineData.IsVisible, OnNodeChecked = LineDataOnNodeChecked @@ -70,7 +70,7 @@ { Text = areaData => OxyPlotResources.ChartData_Area_data_label, Image = areaData => OxyPlotResources.AreaIcon, - CanDrag = (areaData, parentData) => DragOperations.Move, + CanDrag = (areaData, parentData) => true, CanCheck = areaData => true, IsChecked = areaData => areaData.IsVisible, OnNodeChecked = AreaDataOnNodeChecked Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/AreaDataTreeNodeInfoTest.cs =================================================================== diff -u -r9b450b308a40796dd97a4d07b2a191973326cc96 -ra1de055e3698f610875e623d39f4526970568cef --- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/AreaDataTreeNodeInfoTest.cs (.../AreaDataTreeNodeInfoTest.cs) (revision 9b450b308a40796dd97a4d07b2a191973326cc96) +++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/AreaDataTreeNodeInfoTest.cs (.../AreaDataTreeNodeInfoTest.cs) (revision a1de055e3698f610875e623d39f4526970568cef) @@ -85,18 +85,18 @@ } [Test] - public void CanDrag_Always_ReturnsDragOperationsMove() + public void CanDrag_Always_ReturnsTrue() { // Setup var areaData = mocks.StrictMock(Enumerable.Empty>()); mocks.ReplayAll(); // Call - var dragOperations = info.CanDrag(areaData, null); + var canDrag = info.CanDrag(areaData, null); // Assert - Assert.AreEqual(DragOperations.Move, dragOperations); + Assert.IsTrue(canDrag); mocks.VerifyAll(); } Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/LineDataTreeNodeInfoTest.cs =================================================================== diff -u -r9b450b308a40796dd97a4d07b2a191973326cc96 -ra1de055e3698f610875e623d39f4526970568cef --- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/LineDataTreeNodeInfoTest.cs (.../LineDataTreeNodeInfoTest.cs) (revision 9b450b308a40796dd97a4d07b2a191973326cc96) +++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/LineDataTreeNodeInfoTest.cs (.../LineDataTreeNodeInfoTest.cs) (revision a1de055e3698f610875e623d39f4526970568cef) @@ -85,18 +85,18 @@ } [Test] - public void CanDrag_Always_ReturnsDragOperationsMove() + public void CanDrag_Always_ReturnsTrue() { // Setup var lineData = mocks.StrictMock(Enumerable.Empty>()); mocks.ReplayAll(); // Call - var dragOperations = info.CanDrag(lineData, null); + var canDrag = info.CanDrag(lineData, null); // Assert - Assert.AreEqual(DragOperations.Move, dragOperations); + Assert.IsTrue(canDrag); mocks.VerifyAll(); } Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/PointDataTreeNodeInfoTest.cs =================================================================== diff -u -r9b450b308a40796dd97a4d07b2a191973326cc96 -ra1de055e3698f610875e623d39f4526970568cef --- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/PointDataTreeNodeInfoTest.cs (.../PointDataTreeNodeInfoTest.cs) (revision 9b450b308a40796dd97a4d07b2a191973326cc96) +++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/PointDataTreeNodeInfoTest.cs (.../PointDataTreeNodeInfoTest.cs) (revision a1de055e3698f610875e623d39f4526970568cef) @@ -85,18 +85,18 @@ } [Test] - public void CanDrag_Always_ReturnsDragOperationsMove() + public void CanDrag_Always_ReturnsTrue() { // Setup var pointData = mocks.StrictMock(Enumerable.Empty>()); mocks.ReplayAll(); // Call - var dragOperations = info.CanDrag(pointData, null); + var canDrag = info.CanDrag(pointData, null); // Assert - Assert.AreEqual(DragOperations.Move, dragOperations); + Assert.IsTrue(canDrag); mocks.VerifyAll(); } Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs =================================================================== diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -ra1de055e3698f610875e623d39f4526970568cef --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision a1de055e3698f610875e623d39f4526970568cef) @@ -85,7 +85,7 @@ OnNodeRenamed = PipingCalculationContextOnNodeRenamed, CanRemove = PipingCalculationContextCanRemove, OnNodeRemoved = PipingCalculationContextOnNodeRemoved, - CanDrag = (pipingCalculationContext, parentData) => DragOperations.Move + CanDrag = (pipingCalculationContext, parentData) => true }; yield return new TreeNodeInfo @@ -692,13 +692,14 @@ } } - private DragOperations PipingCalculationGroupContextCanDrag(PipingCalculationGroupContext nodeData, object parentData) + private bool PipingCalculationGroupContextCanDrag(PipingCalculationGroupContext nodeData, object parentData) { if (parentData is PipingFailureMechanism) { - return DragOperations.None; + return false; } - return DragOperations.Move; + + return true; } private DragOperations PipingCalculationGroupContextCanDrop(object draggedData, object targetData, DragOperations validOperations) Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -r95487d39e17289b2a656e34d85b808186222c0ee -ra1de055e3698f610875e623d39f4526970568cef --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationContextTreeNodeInfoTest.cs (.../PipingCalculationContextTreeNodeInfoTest.cs) (revision 95487d39e17289b2a656e34d85b808186222c0ee) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationContextTreeNodeInfoTest.cs (.../PipingCalculationContextTreeNodeInfoTest.cs) (revision a1de055e3698f610875e623d39f4526970568cef) @@ -230,13 +230,13 @@ } [Test] - public void CanDrag_Always_ReturnMove() + public void CanDrag_Always_ReturnTrue() { // Call - DragOperations dragAllowed = info.CanDrag(null, null); + var canDrag = info.CanDrag(null, null); // Assert - Assert.AreEqual(DragOperations.Move, dragAllowed); + Assert.IsTrue(canDrag); } [Test] Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -r20f311390d1e8daa85500e8f031d11e9f0f5d9f4 -ra1de055e3698f610875e623d39f4526970568cef --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs (.../PipingCalculationGroupContextTreeNodeInfoTest.cs) (revision 20f311390d1e8daa85500e8f031d11e9f0f5d9f4) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs (.../PipingCalculationGroupContextTreeNodeInfoTest.cs) (revision a1de055e3698f610875e623d39f4526970568cef) @@ -74,7 +74,7 @@ } [Test] - public void CanDrag_WithParentNodeDefaultBehavior_ReturnMove() + public void CanDrag_WithParentNodeDefaultBehavior_ReturnTrue() { // Setup var group = new PipingCalculationGroup(); @@ -87,14 +87,14 @@ pipingFailureMechanismMock); // Call - DragOperations supportedOperation = info.CanDrag(groupContext, null); + var canDrag = info.CanDrag(groupContext, null); // Assert - Assert.AreEqual(DragOperations.Move, supportedOperation); + Assert.IsTrue(canDrag); } [Test] - public void CanDrag_ParentIsPipingFailureMechanism_ReturnNone() + public void CanDrag_ParentIsPipingFailureMechanism_ReturnFalse() { // Setup var pipingFailureMechanism = new PipingFailureMechanism(); @@ -108,10 +108,10 @@ pipingFailureMechanismMock); // Call - DragOperations supportedOperation = info.CanDrag(groupContext, pipingFailureMechanism); + var canDrag = info.CanDrag(groupContext, pipingFailureMechanism); // Assert - Assert.AreEqual(DragOperations.None, supportedOperation); + Assert.IsFalse(canDrag); } [Test]