Search
What's New in this Release

The list below describes recent changes and additions to WpfDiagram:

New in version 4.0.9

New in version 4.0.8

  • New LinkDensity partitioning method added to CompositeLayout, divides the graph depending on ratio of nodes to links in subgraphs.
  • AnnealLayout now normalizes distance calculations, making its cost property values independent from diagram's MeasureUnit.
  • Enable the FlipImage property of ShapeNode to make node's Image follow the geometric shape mirroring specified by FlipX and FlipY properties.
  • Set the AutoDeleteLinks property to false to prevent deleting links along with a node they connect, and disconnect the links instead.

New in version 4.0.7

Custom anchor point / pattern classes

The control now supports serialization of custom AnchorPoint and AnchorPattern -derived objects. Call the RegisterClass method to specify XML or JSON type identifiers of the custom classes. Override SaveToXml and LoadFromXml to serialize custom properties in XML format. Override SaveToJson and LoadFromJson to serialize custom properties in JSON format. Custom classes must also implement no-argument and copy constructors.

Miscellaneous

New in version 4.0.6

.NET 8 support

The distribution now includes assemblies and sample projects for .NET 8. Locally installed assemblies do not appear automatically in Visual Studio toolbox at this time; you can either add references manually or through Nuget package manager.

UI virtualization improvements

Miscellaneous

  • Drag-and-drop ghost image now displays custom node templates.
  • Fix for item interactions starting on mouse-down event, instead of first mouse-move as in version 3 of the diagram.

New in version 4.0.5

  • Fix for custom templates not showing NodeRenderer in new DiagramView.
  • Fixed exception when Scrollable containers are nested.
  • Fixed exception when (programmatically) moving offscreen containers.

New in version 4.0.4

NodeListView improvements

  • The IconSize property specifies the size of node icons displayed by NodeListView.
  • DefaultNodeSize specifies default size of nodes created by dragging from NodeListView.
  • Fixed NodeListView exception when hosted in a third-party accordion control.

ItemLabel improvements

  • Item labels can now by styled using global styles whose TargetType is set to NodeLabel or LinkLabel.
  • ItemLabel JSON serialization fixes.
  • Fixed exception when EnableWrap is set without specifying label's MaxWidth.
  • Fixed label hit-testing when spatial indexing is enabled.

New in version 4.0.3

  • Fix for DiagramLink in-place editor opening at incorrect position.

New in version 4.0.2

Drag-and-drop improvements

Miscellaneous

New in version 4.0.1

New in version 4

Model / view separation

Diagram is now considered a model class and must be displayed inside DiagramView control. DiagramView contains a built-in ScrollViewer, so updating applications to this version should be a matter of replacing old ScrollViewer with new DiagramView, and using zoom, scroll and behavior properties of the view object instead of diagram one.

For compatibility with legacy code, Diagram still inherits from Control and can be used on its own for time being, but following new features are only available through the new DiagramView class. In addition, view-related properties of Diagram, such as ZoomFactor, Scroll position, Behavior, are now marked as obsolete and will display compile warnings when used.

UI virtualization

DiagramView and ContainerNode add UI elements to WPF visual tree only for diagram items they are currently visible in respective viewports. This should improve diagram's rendering / refresh speed.

Note that rendering speed improves only when showing a smaller part of the diagram inside DiagramView's viewport. Rendering a lot of items at small zoom levels or in overview's fit-all mode will still need a lot of processing, so you might want to apply constraints on minimal zoom level of diagram view and overview controls for large diagrams.

Spatial index

Set the EnableSpatialIndex property of Diagram to create an index of item positions for faster hit-testing and viewport clipping queries. When combined with UI virtualization, this should greatly improve user interaction and rendering speed for diagrams containing tens of thousands or more items.

C#  Copy Code

// create 20000 links + nodes in total
for (int i = 0; i < 10000; i++)
{
    var node = diagram.Factory.CreateShapeNode(x, y, size, size);
    node.Text = i.ToString();
    if (x > diagram.Bounds.Left)
    {
        diagram.Factory.CreateDiagramLink(
        diagram.Nodes[i - 1], diagram.Nodes[i]);
    }

    x += dist;
    if (x >= diagram.Bounds.Right)
    {
        x = diagram.Bounds.Left;
        y += dist;
    }
}

diagram.EnableSpatialIndex = true;

Multi-touch support

DiagramView handles WPF touch events and implements multitouch gestures that can be controlled via following properties:

  • If MultiTouchZoom property is enabled (default), the view can be zoomed or panned using two-touch pinch / flick gestures.
  • If MultiTouchModify property is enabled (default), diagram nodes can be moved, scaled and rotated using two-touch pinch / flick gestures.
  • If MultiTouchZoom property is disabled, each touch draws diagram items corresponding to current behavior.
  • If MultiTouchModify property is disabled, each touch started from a node draws a diagram link.
  • Latter modes can be used for collaborative whiteboarding / classroom scenarios.
  • Setting MultiTouchDraw to false lets you prevent drawing multiple items simultaneously, while keeping other multitouch gestures enabled.
  • If MultiTouchDraw is enabled (default), a second touch will still cancel first-touch drawing if added within TouchGestureInterval time and TouchGestureDistance distance, and start a multi-touch gesture.
  • Additional TouchHitDistance property makes it easier to grab adjustment handles on touch screens, without increasing the AdjustmentHandlesSize value.

Async serialization

Files can now be saved and loaded asynchronously. Async methods create a copy of the diagram to process it in a worker thread, and custom item classes must implement Clone method or copy constructor in order to serialize them as expected.

Miscellaneous

API changes

  • Diagram should now be hosted inside DiagramView. For time being it can still be used as a standalone control, but support for this will be removed in a future release.
  • Set Behavior, ZoomFactor, Scroll*, *ButtonActions properties of DiagramView instead of Diagram.
  • Instead of setting Document property of Overview to a Diagram instance, set its DiagramView property.
  • Instead of setting Document property of Ruler to a Diagram instance, set its DiagramView property. The latter is the default content property now. If you still need to show stand-alone diagram inside Ruler from Xaml, you must explicitly set it through <diag:Ruler.Document> tag.
  • For consistency with other MindFusion diagram libraries, DiagramNodeAdapter has been renamed to ControlNode. Its UIElement property has been renamed to Control.