-
Notifications
You must be signed in to change notification settings - Fork 246
Open
Description
This is a fantastic library. Thank you for the effort. Generally well built.
I'm encountering a null reference exception when trying the load a page with the diagram in my MAUI Blazor Hybrid application. Can you please help. Here is what the page looks like
@page "/diagramtest"
@using Blazor.Diagrams
@using Blazor.Diagrams.Components
@using Blazor.Diagrams.Core.Models
@using Blazor.Diagrams.Core.Geometry
@using Blazor.Diagrams.Core.Options
@if (Diagram != null)
{
<CascadingValue Value="Diagram" IsFixed="true">
<DiagramCanvas Diagram="Diagram" class="diagram-container" />
</CascadingValue>
}
else
{
<p>Loading diagram...</p>
}
@code {
private BlazorDiagram? Diagram;
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
var options = new BlazorDiagramOptions
{
Links =
{
DefaultRouter = new NormalRouter(),
DefaultPathGenerator = new StraightPathGenerator()
}
};
Diagram = new BlazorDiagram(options);
// Create a test node
var node = new NodeModel(new Point(100, 100)) { Title = "Test Node" };
Diagram.Nodes.Add(node);
StateHasChanged();
}
}
}
When trying to access this page, I get the message "Loading diagram..." and then the null reference exception pops up.
Metadata
Metadata
Assignees
Labels
No labels