We have released MindFusion.WPF Pack 2023.R2. It adds following new features and improvements:
MindFusion.DiagrammingModel / view separationDiagram 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 virtualizationDiagramView 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 indexSet 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.
// 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 supportDiagramView handles WPF touch messages and implement 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 Diagram.TouchHitDistance property makes it easier to grab adjustment handles on touch screens, without increasing the AdjustmentHandlesSize value.
Async serializationFiles 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.
- async SaveToXmlAsync and LoadFromXmlAsync methods of Diagram and DiagramDocument implement serialization in XML format.
- async SaveToJsonFileAsync, SaveToJsonAsync, LoadFromJsonFileAsync, LoadFromJsonAsync methods of Diagram and DiagramDocument implement serialization in JSON format.
Miscellaneous- PageMoved and PageRenaming events added to TabbedDiagramView.
- Different arrowhead shapes can be filled with distinct brushes as set through HeadBrush, BaseBrush and IntermediateBrush.
- DiagramDocument JSON serialization methods.
- Selectively prevent adding or removing child nodes to/from a container by handling the ContainerChildAdding and ContainerChildRemoving events.
- FoldIconSize property added to ContainerNode.
- Clone methods of Diagram and DiagramDocument return a copy of the diagram / document and its items.
- Fix for ShapeNode.Clone not copying ImagePadding value.
- Set GridPatternHatch and GridPatternThreshold to replace alignment grid with hatch pattern at low zoom levels for faster drawing.
- More precise baseline alignment in exported SVG texts.
- SvgNode parser now supports multiple class names in the "class" attribute of SVG elements.
- Fixed CreateImage results when called with Windows display scaling enabled.
- RemoveLabel now automatically repaints the node.
- OriginAnchor and DestinationAnchor setters now realign segments of cascading links.
- SnapMarksToPixels and MarkLength properties added to Ruler control.
- Fix for HorizontalScaleHeight and VerticalScaleWidth setters not updating the Ruler.
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.
MindFusion.Spreadsheet- The CellIndex class can be used to convert between integer column / row and string representation of a cell address.
- A new [] indexer of CellCollection accepts CellIndex as parameter.
- OldValue, CurrentColumn and CurrentRow properties of IExpressionEvaluatorContext provide more contextual information for custom function evaluation.
- Fixed incorrect bitmap size imported by ExcelImporter.
Virtual Keyboard- Fix for AltGr grapheme generation not working in some applications.
MindFusion.Scheduling- AppointmentForm now accepts return keys in description field to create new lines.
- AppointmentDeleted property added to AppointmentForm.
- Appointment form arrow bitmaps replaced with vector ones.
Installer for the latest version can be downloaded here, or from the
clients area on our site:
https://mindfusion.eu/WpfPackTrial.zipUpdated assemblies are also available as
MindFusion.Pack.Wpf NuGet package.
Enjoy!