diff --git a/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_StackPanel.cs b/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_StackPanel.cs index 01eb29835b98..e65082ad3282 100644 --- a/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_StackPanel.cs +++ b/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_StackPanel.cs @@ -97,14 +97,12 @@ public async Task When_Adding_Or_Removing_Child_Should_Re_Measure() Assert.AreEqual(50, SUT.LastArrangeOverrideReturn.Height); SUT.Children.Remove(SUT.Children.Single()); -#if !__CROSSRUNTIME__ - await TestServices.WindowHelper.WaitForRelayouted(SUT); // arrange is skipped (incorrectly) when finalRect is default, which is the case after removing the last child from StackPanel. + await TestServices.WindowHelper.WaitForRelayouted(SUT); expectedMeasureAndArrangeCount++; Assert.AreEqual(expectedMeasureAndArrangeCount, SUT.MeasureCount); Assert.AreEqual(expectedMeasureAndArrangeCount, SUT.ArrangeCount); Assert.AreEqual(0, SUT.LastMeasureOverrideReturn.Height); Assert.AreEqual(0, SUT.LastArrangeOverrideReturn.Height); -#endif SUT.Children.Add(new Border() { @@ -119,14 +117,12 @@ public async Task When_Adding_Or_Removing_Child_Should_Re_Measure() Assert.AreEqual(50, SUT.LastArrangeOverrideReturn.Height); SUT.Children.Clear(); -#if !__CROSSRUNTIME__ - await TestServices.WindowHelper.WaitForRelayouted(SUT); // arrange is skipped (incorrectly) when finalRect is default, which is the case after removing the last child from StackPanel. + await TestServices.WindowHelper.WaitForRelayouted(SUT); expectedMeasureAndArrangeCount++; Assert.AreEqual(expectedMeasureAndArrangeCount, SUT.MeasureCount); Assert.AreEqual(expectedMeasureAndArrangeCount, SUT.ArrangeCount); Assert.AreEqual(0, SUT.LastMeasureOverrideReturn.Height); Assert.AreEqual(0, SUT.LastArrangeOverrideReturn.Height); -#endif } [TestMethod] diff --git a/src/Uno.UI/UI/Xaml/UIElement.Layout.crossruntime.cs b/src/Uno.UI/UI/Xaml/UIElement.Layout.crossruntime.cs index 35abcc7c7ec1..dbcae6a6901a 100644 --- a/src/Uno.UI/UI/Xaml/UIElement.Layout.crossruntime.cs +++ b/src/Uno.UI/UI/Xaml/UIElement.Layout.crossruntime.cs @@ -304,13 +304,7 @@ public void Arrange(Rect finalRect) var firstArrangeDone = IsFirstArrangeDone; - if (Visibility == Visibility.Collapsed - // If the layout is clipped, and the arranged size is empty, we can skip arranging children - // This scenario is particularly important for the Canvas which always sets its desired size - // zero, even after measuring its children. - || (firstArrangeDone - && finalRect == default - && (this is not ICustomClippingElement clipElement || clipElement.AllowClippingToLayoutSlot))) + if (Visibility == Visibility.Collapsed) { LayoutInformation.SetLayoutSlot(this, finalRect); HideVisual();