Blazor-Diagrams / Blazor.Diagrams

A fully customizable and extensible all-purpose diagrams library for Blazor
https://blazor-diagrams.zhaytam.com
MIT License
1.01k stars 205 forks source link

Support for .Net 8 #412

Closed Trubador closed 8 months ago

Trubador commented 8 months ago

I am getting this issue trying to get the package working on .Net 8 for the following diagram component page: "The name Diagrams does not exist in this context".

@using Blazor.Diagrams.Components

This is using the latest installation and setup documentation from: https://blazor-diagrams.zhaytam.com/

Do you have any hints about what might be the issue?

TheCyberCore commented 8 months ago

Not much input in your question... It is hard to guess your problem. For me, version 3.0.1 works like a charm in .NET 8.0. Here some extracts from the code I am using in .NET 8.0

private BlazorDiagram _diagram { get; set; }
protected override void OnInitialized()
{
    base.OnInitialized();

    var options = new BlazorDiagramOptions
    {
        Zoom = { Enabled = true, ScaleFactor = 1.5 },
        AllowMultiSelection = false, // Whether to allow multi selection using CTRL
        Links =
        {
            DefaultRouter = new NormalRouter(),
            DefaultPathGenerator = new SmoothPathGenerator()
        }
    };

    _diagram = new BlazorDiagram(options);

    // .... Your diagram drawing code goes here
}

Razor part

<CascadingValue Value="_diagram" IsFixed="true">
      <div style="width:1800px;height:800px;">
         <DiagramCanvas></DiagramCanvas>
       </div>
</CascadingValue>
Trubador commented 8 months ago

@TheCyberCore Thanks for the example code. I will try it out. So far I moved the Diagram code to a Net 7 project and it works just fine there so I figured it would be Net 8 that was the cause of failure and thus did not include my code initially in this ticket.