There are several ways to control user actions on the diagram as a whole or on individual items in the diagram.
First of all, setting the Enabled property of DiagramView to false you can make diagram contents non-modifiable at all. Thus it will function as nothing more than a static image you can use to present some data to the user. The diagram can still be modified programmatically though.
To implement interaction in Canvas mode, set it up as described in NetDiagram Front-ends topic.
User interaction on the client side in ImageMap mode is disabled by default. To activate user interaction in ImageMap mode, perform the steps described in Setting up ImageMap mode topic.
The Behavior property provides several predefined sets of rules specifying how user input with the mouse/keyboard is interpreted. If Behavior is set to LinkShapes, mouse dragging over an empty document area is processed as a ShapeNode creation request and dragging over a node creates an link.
Note |
---|
Such behavior leads to some extra work when creating overlaying nodes - users need to draw the second node on an empty area and move it over the first one afterwards. If you want to avoid that, use the DrawShapes behavior. |
If LinkTables is set, dragging the mouse over an empty area creates a table and dragging over a table creates a link. Behavior options also include DrawLinks, DrawTables and Modify.
Items can be locked through the Locked property. Locked items are excluded from selection and users cannot select, move or modify them.
Anchor points define where link's ends should be placed when a user attaches a link to a node. A pattern of anchor points can be assigned to a node by setting the node's AnchorPattern. The SnapToAnchor property specifies whether link ends are aligned to anchor points when creating or modifying links.
Once a link is created, a user can still move its end points to different positions, unless LinkEndsMovable is set to false. This can also be controlled on a per-link basis by means of the AllowMoveEnd and AllowMoveStart properties. You can dynamically validate moving of links' end points using the LinkModifying event.
The AllowSelfLoops property enables or disables drawing of reflexive links. They are allowed by default, but can be disabled if you consider them meaningless for the application. AllowLinksRepeat controls if two nodes can be connected more than once in the same direction.The text of nodes and tables can be edited in-place by double-clicking the respective items. To enable the feature, set the AllowInplaceEdit property to true. For tables, both captions and cells can be edited in this way. Handle the CellTextEditing event to enable or disable in-place editing per cell. Depending on the type of item being edited, one of these events can be fired when editing completes: NodeTextEdited, CellTextEdited. In-place editing mode is exited when users click outside the text entry control.
Event | Description |
---|---|
Raised while a user draws a new node. | |
Raised while a user draws a new link. | |
Raised when the user is trying to delete a node. | |
Raised when the user is trying to delete a link. | |
Raised while a user modifies an existing node. | |
Raised while a user modifies an existing link. |
For more events that can be fired by user's actions, please, consult the Events section of the documentation.
Built-in multi-touch can be disabled altogether by setting enableMultiTouch to false, e.g. if you need to handle touch events yourself or through a third-party gesture library. If disabled, the control will revert to its mouse event handling code from previous versions. It will also no longer be able to capture mouse input during drag operations (to detect mouse pointer leaving the view), which is handled through DOM Pointers API.