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
parentControlThe parent container to search.
tagobjectThe tag value to match.
Returns
- T
The matching control, or null if not found.
Type Parameters
TThe 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
containerControlThe container to search for shapes.
widthdoubleThe new width.
heightdoubleThe 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
visualControlThe root visual to update.
widthdoubleThe new width in screen units (already scaled).
heightdoubleThe new height in screen units (already scaled).
recursiveboolIf 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.