Skip to content

Commit 3e74716

Browse files
982382: Documentation for Allow drag within swimlane
1 parent c7a9925 commit 3e74716

File tree

1 file changed

+20
-1
lines changed
  • UG-Samples/Swimlanes/Lane/AllowDragWithinSwimlane/AllowDragWithinSwimlane/Pages

1 file changed

+20
-1
lines changed

UG-Samples/Swimlanes/Lane/AllowDragWithinSwimlane/AllowDragWithinSwimlane/Pages/Index.razor

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
@page "/"
22

33
@using Syncfusion.Blazor.Diagram
4+
@using TextOverflow = Syncfusion.Blazor.Diagram.TextOverflow
5+
@using TextWrap = Syncfusion.Blazor.Diagram.TextWrap
46

5-
<SfDiagramComponent Height="600px" Swimlanes="@SwimlaneCollections" NodeCreating="@OnNodeCreating" >
7+
<button onclick="@AllowDrag">AllowDrag</button>
8+
<SfDiagramComponent @ref="diagramComponent" Height="600px" Swimlanes="@SwimlaneCollections" NodeCreating="@OnNodeCreating">
69
<SnapSettings Constraints="SnapConstraints.None"></SnapSettings>
710
</SfDiagramComponent>
811

912
@code
1013
{
14+
SfDiagramComponent diagramComponent;
1115
//Define diagram's swimlane collection
1216
DiagramObjectCollection<Swimlane> SwimlaneCollections = new DiagramObjectCollection<Swimlane>();
1317

@@ -102,4 +106,19 @@
102106
};
103107
}
104108
}
109+
public void AllowDrag()
110+
{
111+
if (diagramComponent.SelectionSettings.Nodes.Count > 0)
112+
{
113+
if (diagramComponent.SelectionSettings.Nodes[0].Constraints.HasFlag(NodeConstraints.AllowDragWithinSwimlane))
114+
{
115+
diagramComponent.SelectionSettings.Nodes[0].Constraints &= ~NodeConstraints.AllowDragWithinSwimlane;
116+
117+
}
118+
else
119+
{
120+
diagramComponent.SelectionSettings.Nodes[0].Constraints |= NodeConstraints.AllowDragWithinSwimlane;
121+
}
122+
}
123+
}
105124
}

0 commit comments

Comments
 (0)