Associate Custom Data with Items
You can associate custom values from any data type with diagram elements by setting their
Tag and
Id properties. If the associated data is of a value type or of type that is serializable (marked as
[Serializable] and implementing the
ISerializable interface), then it is saved and loaded together with the diagram items when a diagram is saved or loaded. The
FindNode,
FindLink,
FindNodeById and
FindLinkById methods let you find diagram elements associated with a specific value.
Inspecting Items Geometry
- The Intersects method of DiagramLink lets you test if links intersect other links or nodes.
- The Length method of the DiagramLink class returns the total length of a link.
- The ContainsPoint method let you check if an item contains specified point.
Fluent API
Extension methods in
MindFusion.Diagramming.Wpf.Fluent and
MindFusion.Diagramming.Wpf.Layout.Fluent namespaces let you initialize objects using fluent programming style:
C#
Copy Code
|
---|
using MindFusion.Diagramming.Wpf.Fluent; using MindFusion.Diagramming.Wpf.Layout.Fluent; //...
diagram.Factory .CreateShapeNode(20, 20, 60, 40) .Brush(Colors.LightGray) .Font("Arial", 12) .EnableStyledText(true) .Text("Task <i>1</i>") .ToolTip("This is the task") .TextRotationAngle(15);
new TreeLayout() .LevelDistance(20) .NodeDistance(20) .LinkStyle(TreeLayoutLinkType.Cascading3) .Arrange(diagram); |