diff --git a/src/Avalonia.Controls/StackPanel.cs b/src/Avalonia.Controls/StackPanel.cs
index 0a64096ee9..c2f36b94d7 100644
--- a/src/Avalonia.Controls/StackPanel.cs
+++ b/src/Avalonia.Controls/StackPanel.cs
@@ -157,13 +157,13 @@ namespace Avalonia.Controls
/// Children in this dimension are encouraged to be as large as they like. In the other dimension,
/// StackPanel will assume the maximum size of its children.
///
- /// Constraint
+ /// Constraint
/// Desired size
- protected override Size MeasureOverride(Size constraint)
+ protected override Size MeasureOverride(Size availableSize)
{
Size stackDesiredSize = new Size();
var children = Children;
- Size layoutSlotSize = constraint;
+ Size layoutSlotSize = availableSize;
bool fHorizontal = (Orientation == Orientation.Horizontal);
double spacing = Spacing;
bool hasVisibleChild = false;
@@ -224,7 +224,7 @@ namespace Avalonia.Controls
stackDesiredSize = stackDesiredSize.WithHeight(stackDesiredSize.Height - (hasVisibleChild ? spacing : 0));
}
- return stackDesiredSize;
+ return stackDesiredSize.Constrain(availableSize); // TODO: In WPF `.Constrain(availableSize)` is not used.
}
///