MindFusion.Diagramming is now available for .NET MAUI. Currently supported targets are Windows, macOS, iOS and Android.
The nuget package is located at:
https://www.nuget.org/packages/MindFusion.Diagramming.Maui/Distribution including sample projects and help files is available here:
https://mindfusion.eu/Maui.Diagram.zipCall the UseMindFusionDiagramming extension from CreateMauiApp to configure the library:
namespace DiagramMauiApp;
using MindFusion.Diagramming;
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.UseMindFusionDiagramming()
.......);
return builder.Build();
}
}
In order to use MindFusion.Diagramming types in Xaml, import the "
http://mindfusion.eu/diagramming/maui" namespace schema:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:diag="http://mindfusion.eu/diagramming/maui"
x:Class="DiagramMauiApp.MainPage">
<Grid>
<diag:DiagramView x:Name="diagView" />
</Grid>
</ContentPage>
Unlike the Xamarin diagramming library, in .NET MAUI version the Diagram is just a model class, and can only be shown using DiagramView. Other than that, the Xamarin and MAUI libraries have the same API.
public MainPage()
{
InitializeComponent();
var df = diagView.Diagram.Factory;
var node1 = df.CreateShapeNode(10, 10, 30, 30);
node1.Text = "Hello";
var node2 = df.CreateShapeNode(60, 25, 30, 30);
node2.Text = ".NET MAUI";
df.CreateDiagramLink(node1, node2);
}
Enjoy!