Update ButtonHandler.cs
This commit is contained in:
@@ -60,6 +60,20 @@ public partial class ButtonHandler : ViewHandler<IButton, SkiaButton>
|
|||||||
MapBackground(this, VirtualView);
|
MapBackground(this, VirtualView);
|
||||||
MapPadding(this, VirtualView);
|
MapPadding(this, VirtualView);
|
||||||
MapIsEnabled(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)
|
protected override void ConnectHandler(SkiaButton platformView)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"[TextButtonHandler] ConnectHandler START");
|
||||||
base.ConnectHandler(platformView);
|
base.ConnectHandler(platformView);
|
||||||
|
|
||||||
// Manually map text properties on connect since MAUI may not trigger updates
|
// Manually map text properties on connect since MAUI may not trigger updates
|
||||||
@@ -159,6 +174,17 @@ public partial class TextButtonHandler : ButtonHandler
|
|||||||
MapFont(this, textButton);
|
MapFont(this, textButton);
|
||||||
MapCharacterSpacing(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)
|
public static void MapText(TextButtonHandler handler, ITextButton button)
|
||||||
|
|||||||
Reference in New Issue
Block a user