From 0c94c82b42fd59fd105635eddea7e26d5a22d2d2 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Sat, 17 Mar 2018 23:23:11 +0100 Subject: [PATCH] Don't apply layout constraints to child. The child itself will take care of applying its own layout constraints, applying them in the `ContentPresenter` arrange causes #1447. Fixes #1447. --- src/Avalonia.Controls/Presenters/ContentPresenter.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Avalonia.Controls/Presenters/ContentPresenter.cs b/src/Avalonia.Controls/Presenters/ContentPresenter.cs index d0a438cc2b..54626e9e97 100644 --- a/src/Avalonia.Controls/Presenters/ContentPresenter.cs +++ b/src/Avalonia.Controls/Presenters/ContentPresenter.cs @@ -221,7 +221,7 @@ namespace Avalonia.Controls.Presenters { var content = Content; var oldChild = Child; - var newChild = CreateChild(); + var newChild = CreateChild(); // Remove the old child if we're not recycling it. if (oldChild != null && newChild != oldChild) @@ -397,8 +397,6 @@ namespace Avalonia.Controls.Presenters size = size.WithHeight(Math.Min(size.Height, DesiredSize.Height - padding.Top - padding.Bottom)); } - size = LayoutHelper.ApplyLayoutConstraints(Child, size); - if (useLayoutRounding) { size = new Size( @@ -412,7 +410,6 @@ namespace Avalonia.Controls.Presenters switch (horizontalContentAlignment) { case HorizontalAlignment.Center: - case HorizontalAlignment.Stretch: originX += (availableSizeMinusMargins.Width - size.Width) / 2; break; case HorizontalAlignment.Right: @@ -423,7 +420,6 @@ namespace Avalonia.Controls.Presenters switch (verticalContentAlignment) { case VerticalAlignment.Center: - case VerticalAlignment.Stretch: originY += (availableSizeMinusMargins.Height - size.Height) / 2; break; case VerticalAlignment.Bottom: