From 178d23e6d7360b5b78ecd9cc801f0d88639d6a1e Mon Sep 17 00:00:00 2001 From: MartyIX <203266+MartyIX@users.noreply.github.com> Date: Fri, 12 Apr 2024 11:00:19 +0200 Subject: [PATCH] Less interops --- src/Core/src/Handlers/Layout/LayoutHandler.Windows.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Core/src/Handlers/Layout/LayoutHandler.Windows.cs b/src/Core/src/Handlers/Layout/LayoutHandler.Windows.cs index 2a4836b2ca1f..644750214359 100644 --- a/src/Core/src/Handlers/Layout/LayoutHandler.Windows.cs +++ b/src/Core/src/Handlers/Layout/LayoutHandler.Windows.cs @@ -26,11 +26,12 @@ public override void SetVirtualView(IView view) PlatformView.CrossPlatformLayout = VirtualView; - PlatformView.Children.Clear(); + var children = PlatformView.Children; + children.Clear(); foreach (var child in VirtualView.OrderByZIndex()) { - PlatformView.Children.Add(child.ToPlatform(MauiContext)); + children.Add(child.ToPlatform(MauiContext)); } } @@ -108,7 +109,8 @@ void EnsureZIndexOrder(IView child) return; } - var currentIndex = PlatformView.Children.IndexOf(child.ToPlatform(MauiContext!)); + var children = PlatformView.Children; + var currentIndex = children.IndexOf(child.ToPlatform(MauiContext!)); if (currentIndex == -1) { @@ -119,7 +121,7 @@ void EnsureZIndexOrder(IView child) if (currentIndex != targetIndex) { - PlatformView.Children.Move((uint)currentIndex, (uint)targetIndex); + children.Move((uint)currentIndex, (uint)targetIndex); } }