Q: Is there a way to limit the number of links that a shape node will accept in and allow out?
A: You can handle the LinkCreating and LinkModifying validation events and allow or prevent the operation depending on how many links are connected to a node.
Q: Is there a way to limit the number of shape nodes of a particular type that can be added to a diagram?
A: Handle the NodeCreating event and set e.Cancel = true if there are more than a certain number of nodes in the diagram.
Q: How to prevent users from creating cycles in the graph?
A: Here is an easy way to do that:
private void diagram_LinkModifying(object sender, MindFusion.Diagramming.LinkValidationEventArgs e) { if (e.ChangingOrigin || e.ChangingDestination) { PathFinder finder = new PathFinder(diagram, false); if (finder.FindShortestPath( e.Destination, e.Origin) != null) e.Cancel = true; } } private void diagram_LinkCreating(object sender, MindFusion.Diagramming.LinkValidationEventArgs e) { PathFinder finder = new PathFinder(diagram, false); if (finder.FindShortestPath( e.Destination, e.Origin) != null) e.Cancel = true; }
Q: In my diagram, two nodes are overlapped. When I click on the overlapped area, I want that always the same node is selected. Is there a way to give a priority to a Node I want to select?
A: Assign a bigger ZIndex value to the node that has a higher priority. Only at the time when the nodes are clicked, call GetNodesAt to find all nodes at the mouse position, and select one of them programmatically.
Q: I want that when I move a Node, the head or base of the link connected to the node move round the border of the node, like one of the examples in FlowChart.NET Demo (Links --> Form Preservation). I set the property RetainForm to true. However, this is not enough...what is the correct property I must set?
A: Try setting DiagramLink.Dynamic to true, that's the property that updates the link end point positions while a node is moved around. Enable RetainForm to have the positions of the intermediate control points updated too, so that the initial shape of the link is preserved. RetainForm might be ignored if AutoRoute is enabled.
Q:How to enable the user to make more than one link from one table to another (not from the same row)?
A: Setting Diagram.AllowLinksRepeat to true will enable that.