Search
Items Placement - Position, Size and Z-order

Measure Unit

The MeasureUnit property specifies the unit of measure for all location and size-related values assigned to WpfDiagram properties or passed as arguments to its methods.

Location and Size of Nodes

Use the Bounds property to get or change the location and size of a node. To move a node without changing its size, call the Move method. To change only the size of a node, invoke the Resize method. ShapeNode.ResizeToFitImage and TableNode.ResizeToFitImage methods set nodes' sizes to fit that of their pictures.

Links Control Points

Links have two or more control points, depending on their Shape and SegmentCount. You can get access to the control points by the link's ControlPoints collection. You must call UpdateFromPoints after moving control points of a link; that's needed in order to repaint the link and update its internal state variables. The Bounds property is read-only. It returns the smallest rectangle that bounds all link points.

Link Dynamics

The Dynamic property of a link can be enabled to make the link automatically recalculate its end point positions if the nodes connected to the link are moved or resized; the end points are moved in such a way that the link points to the centers of the connected nodes. A related property is AutoSnapToNode, which can be enabled to make the link end points align to the border of their origin or destination nodes while a user move the link ends.

RetainForm is useful for links that have more than two control points. If the nodes that a link connects are moved around, usually only the segments at the ends of that link are updated, so that they stay connected to their respective nodes. In that case all intermediate control points stay where they are. However, if RetainForm is enabled, all control points will move simultaneously in a way they preserve their relative position to each other, and thus preserving the overall form of the link.

Links have an AutoRoute property that enables or disables automatic routing of a link. Routed links avoid nodes by finding the shortest path between their origin and destination that does not cross any other nodes. The link routing algorithm can be tuned by using the properties exposed by RoutingOptions.

Interactive Moving or Resizing

End-users of your application can move or resize the diagram elements. They do this by selecting an item and dragging any of its adjustment handles, a point inside its interior, any of its sides or a selection frame. The HandlesStyle property of nodes controls how interaction can be performed. Additionally it defines the representation of selected items on screen. EnabledHandles lets you disable specific manipulations users are allowed to perform on a node, for example resizing the item horizontally or moving it. If an item is modified interactively, the NodeModified or LinkModified event is raised, depending on the item's type.

Controlling the Z-order

The Z-order defines how items are ordered on the Z-axis - so that one looks above or below another. Members of the DiagramItem class give you full control over the Z-order. To move an item one level up or down, invoke the ZLevelUp or ZLevelDown methods. To move an item to the bottom of the Z-order call its ZBottom method. To move the item in front of all others, call its ZTop method. You can use the ZIndex property to get or set the index of an item within the Z-order array.