From 5415c71e9ef3d040459a824dbdfdb57a6ea8447e Mon Sep 17 00:00:00 2001 From: logikonline Date: Sat, 24 Jan 2026 02:00:00 +0000 Subject: [PATCH] Update ButtonHandler.cs --- Handlers/ButtonHandler.cs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Handlers/ButtonHandler.cs b/Handlers/ButtonHandler.cs index 11f4e75..97262bc 100644 --- a/Handlers/ButtonHandler.cs +++ b/Handlers/ButtonHandler.cs @@ -60,6 +60,20 @@ public partial class ButtonHandler : ViewHandler MapBackground(this, VirtualView); MapPadding(this, VirtualView); MapIsEnabled(this, VirtualView); + + // Map size requests from MAUI Button + if (VirtualView is Microsoft.Maui.Controls.Button mauiButton) + { + Console.WriteLine($"[ButtonHandler] MapSize Text='{platformView.Text}' WReq={mauiButton.WidthRequest} HReq={mauiButton.HeightRequest}"); + if (mauiButton.WidthRequest >= 0) + platformView.WidthRequest = mauiButton.WidthRequest; + if (mauiButton.HeightRequest >= 0) + platformView.HeightRequest = mauiButton.HeightRequest; + } + else + { + Console.WriteLine($"[ButtonHandler] VirtualView is NOT Microsoft.Maui.Controls.Button, type={VirtualView?.GetType().Name}"); + } } } @@ -148,6 +162,7 @@ public partial class TextButtonHandler : ButtonHandler protected override void ConnectHandler(SkiaButton platformView) { + Console.WriteLine($"[TextButtonHandler] ConnectHandler START"); base.ConnectHandler(platformView); // Manually map text properties on connect since MAUI may not trigger updates @@ -159,6 +174,17 @@ public partial class TextButtonHandler : ButtonHandler MapFont(this, textButton); MapCharacterSpacing(this, textButton); } + + // Map size requests from MAUI Button + if (VirtualView is Microsoft.Maui.Controls.Button mauiButton) + { + Console.WriteLine($"[TextButtonHandler] MapSize Text='{platformView.Text}' WReq={mauiButton.WidthRequest} HReq={mauiButton.HeightRequest}"); + if (mauiButton.WidthRequest >= 0) + platformView.WidthRequest = mauiButton.WidthRequest; + if (mauiButton.HeightRequest >= 0) + platformView.HeightRequest = mauiButton.HeightRequest; + } + Console.WriteLine($"[TextButtonHandler] ConnectHandler DONE"); } public static void MapText(TextButtonHandler handler, ITextButton button)