Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic .NET MAUI Diagram control preview (Read 3116 times)
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3154
Joined: Oct 19th, 2005
.NET MAUI Diagram control preview
Sep 16th, 2022 at 8:10am
Print Post  
A preview build of our .NET MAUI Diagram control is now available as a nuget package. If anyone is interested in trying it out, please install it from:

https://www.nuget.org/packages/MindFusion.Diagramming.Maui/

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);
} 



Currently we support iOS, Android and Windows targets. MacOS one will be available for official release.

Any comments, questions and general feedback are welcome.
« Last Edit: Nov 15th, 2022 at 3:31pm by Slavcho »  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3154
Joined: Oct 19th, 2005
Re: .NET MAUI Diagram control preview
Reply #1 - Jan 2nd, 2023 at 6:01am
Print Post  
The 0.7 build of Diagramming.Maui package now includes macOS assemblies:
https://www.nuget.org/packages/MindFusion.Diagramming.Maui/
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint