From 4f50faefc497f9602f91639977ba0a52b67958dc Mon Sep 17 00:00:00 2001 From: webwarrior Date: Wed, 8 Mar 2023 14:22:06 +0100 Subject: [PATCH] Core(Gtk): implement visibility in layouts Layouts in Gtk now react to change in Visibility property. --- src/Core/src/Handlers/Layout/LayoutHandler.Gtk.cs | 14 +++++++++++++- src/Core/src/Handlers/Layout/LayoutHandler.cs | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Core/src/Handlers/Layout/LayoutHandler.Gtk.cs b/src/Core/src/Handlers/Layout/LayoutHandler.Gtk.cs index b73aa582322d..349beb05ed8f 100644 --- a/src/Core/src/Handlers/Layout/LayoutHandler.Gtk.cs +++ b/src/Core/src/Handlers/Layout/LayoutHandler.Gtk.cs @@ -124,9 +124,21 @@ public override Size GetDesiredSize(double widthConstraint, double heightConstra #endif + private void UpdateVisibility(Visibility visibility) + { + if (visibility == Visibility.Visible) + PlatformView.Show(); + else + PlatformView.Hide(); + } + [MissingMapper] public void UpdateZIndex(IView view) => throw new NotImplementedException(); + static void MapVisibility(ILayoutHandler handler, ILayout layout) + { + ((LayoutHandler)handler).UpdateVisibility(layout.Visibility); + } } -} \ No newline at end of file +} diff --git a/src/Core/src/Handlers/Layout/LayoutHandler.cs b/src/Core/src/Handlers/Layout/LayoutHandler.cs index fae19d866735..6057f5bdcc1c 100644 --- a/src/Core/src/Handlers/Layout/LayoutHandler.cs +++ b/src/Core/src/Handlers/Layout/LayoutHandler.cs @@ -23,6 +23,9 @@ public partial class LayoutHandler : ILayoutHandler [nameof(ILayout.ClipsToBounds)] = MapClipsToBounds, #if ANDROID || WINDOWS [nameof(IView.InputTransparent)] = MapInputTransparent, +#endif +#if GTK + [nameof(IView.Visibility)] = MapVisibility, #endif };