First preview build of our diagramming library for Avalonia UI is now available as NuGet package:
https://www.nuget.org/packages/MindFusion.Diagramming.AvaloniaThis is a technical preview, offering a core subset of the features you know from our WPF library (DiagramView control only, ShapeNode and ContainerNode types, no import/export classes yet).
Here’s how to quickly integrate it into your Avalonia project:
Register the LibraryIn Program.cs, add the UseMindFusionDiagramming() call to AppBuilder chain:
using MindFusion.Diagramming.Avalonia;
...
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.UseMindFusionDiagramming()
.WithInterFont()
.LogToTrace();
Add the XAML NamespaceIn your Window or UserControl XAML file, add the MindFusion.Diagramming.Avalonia namespace:
<Window xmlns="https://github.com/avaloniaui"
...
xmlns:diag="using:MindFusion.Diagramming.Avalonia">
Add the DiagramView ControlYou can now add DiagramView to your layout:
<diag:DiagramView x:Name="diagramView" />
Interact with the APIThe API should look the same to users of our WPF version (
https://mindfusion.dev/docs/wpf/diagramming/). The primary difference is the use of Avalonia's native geometry and drawing types (Avalonia.Rect, Avalonia.Point, Avalonia.Media.IBrush, etc).
Here is a simple example of creating a few nodes and a link from your code-behind:
var diagram = diagramView.Diagram;
var node1 = diagram.Factory.CreateShapeNode(70, 300, 100, 100);
node1.Text = "Hello";
var node2 = diagram.Factory.CreateShapeNode(350, 200, 100, 100);
node2.Text = "Avalonia";
var link = diagram.Factory.CreateDiagramLink(node1, node2);
var ctr = diagram.Factory.CreateContainerNode(30, 30, 200, 200);
ctr.Text = "ctr";
diagramView.AllowInplaceEdit = true;
Important Notes for This Preview- This is an early build. While we have worked to ensure stability, you may encounter issues.
- The API surface is not yet complete compared to the WPF version, but the core diagramming functionality is in place.
- As we discovered during the port, Avalonia's immutable structs require a different approach to geometry calculations. You may need to adjust diagram-related code that manipulates Rect and Point objects if porting from WPF or WinForms.
Any comments, questions and general feedback are welcome. We are particularly interested in hearing what features from the WPF version you would like to see prioritized.