Table of Contents

Class NodeVisualHelper

Namespace
FlowGraph.Avalonia.Rendering.NodeRenderers
Assembly
FlowGraph.Avalonia.dll

Helper methods for updating node visuals consistently. Use these methods in INodeRenderer.UpdateSize implementations to ensure all child elements are properly updated.

public static class NodeVisualHelper
Inheritance
NodeVisualHelper
Inherited Members

Methods

FindByTag<T>(Control, object)

Finds a child control by its Tag value.

public static T? FindByTag<T>(Control parent, object tag) where T : Control

Parameters

parent Control

The parent container to search.

tag object

The tag value to match.

Returns

T

The matching control, or null if not found.

Type Parameters

T

The expected control type.

UpdateShapeChildren(Control, double, double)

Updates only direct Shape children within a container to the specified size. Useful for updating background/border rectangles without affecting content.

public static void UpdateShapeChildren(Control container, double width, double height)

Parameters

container Control

The container to search for shapes.

width double

The new width.

height double

The new height.

UpdateVisualSize(Control, double, double, bool)

Recursively updates the size of a visual and all its children. This is a best-effort update that handles common Avalonia controls.

public static void UpdateVisualSize(Control visual, double width, double height, bool recursive = false)

Parameters

visual Control

The root visual to update.

width double

The new width in screen units (already scaled).

height double

The new height in screen units (already scaled).

recursive bool

If true, recursively updates child containers.

Remarks

This helper updates Width/Height on common container types and shapes. For complex visuals with custom layout logic, you may need to implement custom update logic in addition to using this helper.