Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Diagramming for .NET MAUI, V1.0 (Read 2932 times)
Forum Admin
YaBB Administrator
*****
Offline


Rock and Roll

Posts: 691
Joined: Apr 6th, 2003
Diagramming for .NET MAUI, V1.0
Mar 24th, 2023 at 9:05am
Print Post  
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.zip

Call the UseMindFusionDiagramming extension from CreateMauiApp to configure the library:

Code
Select All
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:

Code
Select All
<?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.

Code
Select All
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!
« Last Edit: Nov 7th, 2023 at 10:51am by Forum Admin »  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint