Table of Contents

Interface IEdgeRenderer

Namespace
FlowGraph.Avalonia.Rendering.EdgeRenderers
Assembly
FlowGraph.Avalonia.dll

Interface for custom edge renderers. Implement this interface to create custom visual representations for edge types.

public interface IEdgeRenderer

Examples

// Register a custom edge renderer
canvas.EdgeRenderers.Register("sequence-message", new SequenceMessageEdgeRenderer());

// Create an edge with custom type
var edge = new Edge(...) { Type = EdgeType.Custom };
edge.Definition = edge.Definition with { CustomType = "sequence-message" };

Remarks

Edge renderers control the visual appearance of connections between nodes. Unlike the default edge rendering (bezier curves), custom renderers can create any visual representation: orthogonal lines, curved paths, animated connections, or complex visuals like sequence diagram lifelines.

Edge renderers are registered by edge type string (e.g., "sequence-message", "swimlane-flow") using EdgeRendererRegistry.

Methods

GetHitTestGeometry(Edge, EdgeRenderContext)

Gets the hit test geometry for click detection. Return a wider path than the visible path for easier clicking.

Geometry? GetHitTestGeometry(Edge edge, EdgeRenderContext context)

Parameters

edge Edge

The edge to get hit area for.

context EdgeRenderContext

The rendering context.

Returns

Geometry

A geometry for hit testing, or null to use default.

Render(Edge, EdgeRenderContext)

Creates the visual representation for an edge.

EdgeRenderResult Render(Edge edge, EdgeRenderContext context)

Parameters

edge Edge

The edge to render.

context EdgeRenderContext

The rendering context with coordinates, theme, and scale.

Returns

EdgeRenderResult

The rendered edge elements (path, labels, markers).

UpdateSelection(EdgeRenderResult, Edge, EdgeRenderContext)

Updates the visual state when selection changes.

void UpdateSelection(EdgeRenderResult result, Edge edge, EdgeRenderContext context)

Parameters

result EdgeRenderResult

The render result containing visual elements.

edge Edge

The edge data.

context EdgeRenderContext

The rendering context.