Skip to content

Commit 06ab709

Browse files
BobLdemmauss
andauthored
Ensure VirtualizingStackPanel correct element size estimate and fix #17460 (#17461)
Co-authored-by: Emmanuel Hansen <[email protected]>
1 parent 03f91a2 commit 06ab709

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Avalonia.Controls/VirtualizingStackPanel.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Collections.Generic;
33
using System.Collections.Specialized;
44
using System.Diagnostics;
5-
using System.Drawing;
65
using System.Linq;
76
using Avalonia.Controls.Primitives;
87
using Avalonia.Controls.Utils;
@@ -164,6 +163,9 @@ protected override Size MeasureOverride(Size availableSize)
164163
_realizedElements ??= new();
165164
_measureElements ??= new();
166165

166+
// We need to set the lastEstimatedElementSizeU before calling CalculateDesiredSize()
167+
_ = EstimateElementSizeU();
168+
167169
// We handle horizontal and vertical layouts here so X and Y are abstracted to:
168170
// - Horizontal layouts: U = horizontal, V = vertical
169171
// - Vertical layouts: U = vertical, V = horizontal

0 commit comments

Comments
 (0)