diff --git a/src/Shared/HandyControl_Shared/Controls/Panel/RelativePanel.cs b/src/Shared/HandyControl_Shared/Controls/Panel/RelativePanel.cs index 2d379b184..410341a7f 100644 --- a/src/Shared/HandyControl_Shared/Controls/Panel/RelativePanel.cs +++ b/src/Shared/HandyControl_Shared/Controls/Panel/RelativePanel.cs @@ -417,10 +417,18 @@ public GraphNode AddNode(UIElement value) public void Measure(Size availableSize) { - AvailableSize = availableSize; + AvailableSize = EnsureValidSize(availableSize); Measure(_nodeDic.Values, null); } + private static Size EnsureValidSize(Size size) + { + var width = double.IsInfinity(size.Width) ? 0 : size.Width; + var height = double.IsInfinity(size.Height) ? 0 : size.Height; + + return new Size(width, height); + } + private void Measure(IEnumerable nodes, HashSet set) { set ??= new HashSet();