Verify and fix handlers against decompiled production
- ImageHandler.Linux.cs: Verified matches production - ScrollViewHandler.Linux.cs: Verified matches production - StepperHandler.Linux.cs: Verified matches production - RadioButtonHandler.Linux.cs: Verified matches production - SearchBarHandler.Linux.cs: Fixed namespace, added CancelButtonColor, SolidPaint, null checks - ImageButtonHandler.cs: Verified matches production - DatePickerHandler.cs: Verified matches production - TimePickerHandler.cs: Verified matches production 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
105
Handlers/RadioButtonHandler.Linux.cs
Normal file
105
Handlers/RadioButtonHandler.Linux.cs
Normal file
@@ -0,0 +1,105 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
|
||||
using System;
|
||||
using Microsoft.Maui.Controls;
|
||||
using Microsoft.Maui.Graphics;
|
||||
using Microsoft.Maui.Handlers;
|
||||
|
||||
namespace Microsoft.Maui.Platform.Linux.Handlers;
|
||||
|
||||
/// <summary>
|
||||
/// Linux handler for RadioButton control.
|
||||
/// </summary>
|
||||
public class RadioButtonHandler : ViewHandler<IRadioButton, SkiaRadioButton>
|
||||
{
|
||||
public static IPropertyMapper<IRadioButton, RadioButtonHandler> Mapper = new PropertyMapper<IRadioButton, RadioButtonHandler>(ViewHandler.ViewMapper)
|
||||
{
|
||||
["IsChecked"] = MapIsChecked,
|
||||
["TextColor"] = MapTextColor,
|
||||
["Font"] = MapFont,
|
||||
["Background"] = MapBackground
|
||||
};
|
||||
|
||||
public static CommandMapper<IRadioButton, RadioButtonHandler> CommandMapper = new(ViewHandler.ViewCommandMapper);
|
||||
|
||||
public RadioButtonHandler() : base(Mapper, CommandMapper)
|
||||
{
|
||||
}
|
||||
|
||||
public RadioButtonHandler(IPropertyMapper? mapper, CommandMapper? commandMapper = null)
|
||||
: base(mapper ?? Mapper, commandMapper ?? CommandMapper)
|
||||
{
|
||||
}
|
||||
|
||||
protected override SkiaRadioButton CreatePlatformView()
|
||||
{
|
||||
return new SkiaRadioButton();
|
||||
}
|
||||
|
||||
protected override void ConnectHandler(SkiaRadioButton platformView)
|
||||
{
|
||||
base.ConnectHandler(platformView);
|
||||
platformView.CheckedChanged += OnCheckedChanged;
|
||||
|
||||
if (VirtualView is RadioButton radioButton)
|
||||
{
|
||||
platformView.Content = radioButton.Content?.ToString() ?? "";
|
||||
platformView.GroupName = radioButton.GroupName;
|
||||
platformView.Value = radioButton.Value;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void DisconnectHandler(SkiaRadioButton platformView)
|
||||
{
|
||||
platformView.CheckedChanged -= OnCheckedChanged;
|
||||
base.DisconnectHandler(platformView);
|
||||
}
|
||||
|
||||
private void OnCheckedChanged(object? sender, EventArgs e)
|
||||
{
|
||||
if (VirtualView != null && PlatformView != null)
|
||||
{
|
||||
VirtualView.IsChecked = PlatformView.IsChecked;
|
||||
}
|
||||
}
|
||||
|
||||
public static void MapIsChecked(RadioButtonHandler handler, IRadioButton radioButton)
|
||||
{
|
||||
if (handler.PlatformView != null)
|
||||
{
|
||||
handler.PlatformView.IsChecked = radioButton.IsChecked;
|
||||
}
|
||||
}
|
||||
|
||||
public static void MapTextColor(RadioButtonHandler handler, IRadioButton radioButton)
|
||||
{
|
||||
if (handler.PlatformView != null && radioButton.TextColor != null)
|
||||
{
|
||||
handler.PlatformView.TextColor = radioButton.TextColor.ToSKColor();
|
||||
}
|
||||
}
|
||||
|
||||
public static void MapFont(RadioButtonHandler handler, IRadioButton radioButton)
|
||||
{
|
||||
if (handler.PlatformView != null)
|
||||
{
|
||||
var font = radioButton.Font;
|
||||
if (font.Size > 0)
|
||||
{
|
||||
handler.PlatformView.FontSize = (float)font.Size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void MapBackground(RadioButtonHandler handler, IRadioButton radioButton)
|
||||
{
|
||||
if (handler.PlatformView != null)
|
||||
{
|
||||
if (radioButton.Background is SolidPaint solidPaint && solidPaint.Color != null)
|
||||
{
|
||||
handler.PlatformView.BackgroundColor = solidPaint.Color.ToSKColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user