Fix compilation: restore clean RC1 codebase

- Restore clean BindableProperty.Create syntax from RC1 commit
- Remove decompiler artifacts with mangled delegate types
- Add Svg.Skia package reference for icon support
- Fix duplicate type definitions
- Library now compiles successfully (0 errors)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-01 07:43:44 -05:00
parent 33914bf572
commit 2a4e35cd39
258 changed files with 35256 additions and 49900 deletions

View File

@@ -1,175 +1,161 @@
using System;
using System.Collections.Specialized;
using System.Linq;
using Microsoft.Maui.Controls;
using Microsoft.Maui.Graphics;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Microsoft.Maui.Handlers;
using Microsoft.Maui.Graphics;
using Microsoft.Maui.Controls;
using Microsoft.Maui.Platform;
using SkiaSharp;
using System.Collections.Specialized;
namespace Microsoft.Maui.Platform.Linux.Handlers;
public class PickerHandler : ViewHandler<IPicker, SkiaPicker>
/// <summary>
/// Handler for Picker on Linux using Skia rendering.
/// </summary>
public partial class PickerHandler : ViewHandler<IPicker, SkiaPicker>
{
public static IPropertyMapper<IPicker, PickerHandler> Mapper = (IPropertyMapper<IPicker, PickerHandler>)(object)new PropertyMapper<IPicker, PickerHandler>((IPropertyMapper[])(object)new IPropertyMapper[1] { (IPropertyMapper)ViewHandler.ViewMapper })
{
["Title"] = MapTitle,
["TitleColor"] = MapTitleColor,
["SelectedIndex"] = MapSelectedIndex,
["TextColor"] = MapTextColor,
["Font"] = MapFont,
["CharacterSpacing"] = MapCharacterSpacing,
["HorizontalTextAlignment"] = MapHorizontalTextAlignment,
["VerticalTextAlignment"] = MapVerticalTextAlignment,
["Background"] = MapBackground,
["ItemsSource"] = MapItemsSource
};
public static IPropertyMapper<IPicker, PickerHandler> Mapper =
new PropertyMapper<IPicker, PickerHandler>(ViewHandler.ViewMapper)
{
[nameof(IPicker.Title)] = MapTitle,
[nameof(IPicker.TitleColor)] = MapTitleColor,
[nameof(IPicker.SelectedIndex)] = MapSelectedIndex,
[nameof(IPicker.TextColor)] = MapTextColor,
[nameof(IPicker.CharacterSpacing)] = MapCharacterSpacing,
[nameof(IPicker.HorizontalTextAlignment)] = MapHorizontalTextAlignment,
[nameof(IPicker.VerticalTextAlignment)] = MapVerticalTextAlignment,
[nameof(IView.Background)] = MapBackground,
[nameof(Picker.ItemsSource)] = MapItemsSource,
};
public static CommandMapper<IPicker, PickerHandler> CommandMapper = new CommandMapper<IPicker, PickerHandler>((CommandMapper)(object)ViewHandler.ViewCommandMapper);
public static CommandMapper<IPicker, PickerHandler> CommandMapper =
new(ViewHandler.ViewCommandMapper)
{
};
private INotifyCollectionChanged? _itemsCollection;
private INotifyCollectionChanged? _itemsCollection;
public PickerHandler()
: base((IPropertyMapper)(object)Mapper, (CommandMapper)(object)CommandMapper)
{
}
public PickerHandler() : base(Mapper, CommandMapper)
{
}
public PickerHandler(IPropertyMapper? mapper, CommandMapper? commandMapper = null)
: base((IPropertyMapper)(((object)mapper) ?? ((object)Mapper)), (CommandMapper)(((object)commandMapper) ?? ((object)CommandMapper)))
{
}
public PickerHandler(IPropertyMapper? mapper, CommandMapper? commandMapper = null)
: base(mapper ?? Mapper, commandMapper ?? CommandMapper)
{
}
protected override SkiaPicker CreatePlatformView()
{
return new SkiaPicker();
}
protected override SkiaPicker CreatePlatformView()
{
return new SkiaPicker();
}
protected override void ConnectHandler(SkiaPicker platformView)
{
base.ConnectHandler(platformView);
platformView.SelectedIndexChanged += OnSelectedIndexChanged;
IPicker virtualView = base.VirtualView;
Picker val = (Picker)(object)((virtualView is Picker) ? virtualView : null);
if (val != null && val.Items is INotifyCollectionChanged itemsCollection)
{
_itemsCollection = itemsCollection;
_itemsCollection.CollectionChanged += OnItemsCollectionChanged;
}
ReloadItems();
}
protected override void ConnectHandler(SkiaPicker platformView)
{
base.ConnectHandler(platformView);
platformView.SelectedIndexChanged += OnSelectedIndexChanged;
protected override void DisconnectHandler(SkiaPicker platformView)
{
platformView.SelectedIndexChanged -= OnSelectedIndexChanged;
if (_itemsCollection != null)
{
_itemsCollection.CollectionChanged -= OnItemsCollectionChanged;
_itemsCollection = null;
}
base.DisconnectHandler(platformView);
}
// Subscribe to items collection changes
if (VirtualView is Picker picker && picker.Items is INotifyCollectionChanged items)
{
_itemsCollection = items;
_itemsCollection.CollectionChanged += OnItemsCollectionChanged;
}
private void OnItemsCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
{
ReloadItems();
}
// Load items
ReloadItems();
}
private void OnSelectedIndexChanged(object? sender, EventArgs e)
{
if (base.VirtualView != null && base.PlatformView != null)
{
base.VirtualView.SelectedIndex = base.PlatformView.SelectedIndex;
}
}
protected override void DisconnectHandler(SkiaPicker platformView)
{
platformView.SelectedIndexChanged -= OnSelectedIndexChanged;
private void ReloadItems()
{
if (base.PlatformView != null && base.VirtualView != null)
{
string[] itemsAsArray = IPickerExtension.GetItemsAsArray(base.VirtualView);
base.PlatformView.SetItems(itemsAsArray.Select((string i) => i?.ToString() ?? ""));
}
}
if (_itemsCollection != null)
{
_itemsCollection.CollectionChanged -= OnItemsCollectionChanged;
_itemsCollection = null;
}
public static void MapTitle(PickerHandler handler, IPicker picker)
{
if (((ViewHandler<IPicker, SkiaPicker>)(object)handler).PlatformView != null)
{
((ViewHandler<IPicker, SkiaPicker>)(object)handler).PlatformView.Title = picker.Title ?? "";
}
}
base.DisconnectHandler(platformView);
}
public static void MapTitleColor(PickerHandler handler, IPicker picker)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
if (((ViewHandler<IPicker, SkiaPicker>)(object)handler).PlatformView != null && picker.TitleColor != null)
{
((ViewHandler<IPicker, SkiaPicker>)(object)handler).PlatformView.TitleColor = picker.TitleColor.ToSKColor();
}
}
private void OnItemsCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
{
ReloadItems();
}
public static void MapSelectedIndex(PickerHandler handler, IPicker picker)
{
if (((ViewHandler<IPicker, SkiaPicker>)(object)handler).PlatformView != null)
{
((ViewHandler<IPicker, SkiaPicker>)(object)handler).PlatformView.SelectedIndex = picker.SelectedIndex;
}
}
private void OnSelectedIndexChanged(object? sender, EventArgs e)
{
if (VirtualView is null || PlatformView is null) return;
public static void MapTextColor(PickerHandler handler, IPicker picker)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
if (((ViewHandler<IPicker, SkiaPicker>)(object)handler).PlatformView != null && ((ITextStyle)picker).TextColor != null)
{
((ViewHandler<IPicker, SkiaPicker>)(object)handler).PlatformView.TextColor = ((ITextStyle)picker).TextColor.ToSKColor();
}
}
VirtualView.SelectedIndex = PlatformView.SelectedIndex;
}
public static void MapFont(PickerHandler handler, IPicker picker)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
if (((ViewHandler<IPicker, SkiaPicker>)(object)handler).PlatformView != null)
{
Font font = ((ITextStyle)picker).Font;
if (!string.IsNullOrEmpty(((Font)(ref font)).Family))
{
((ViewHandler<IPicker, SkiaPicker>)(object)handler).PlatformView.FontFamily = ((Font)(ref font)).Family;
}
if (((Font)(ref font)).Size > 0.0)
{
((ViewHandler<IPicker, SkiaPicker>)(object)handler).PlatformView.FontSize = (float)((Font)(ref font)).Size;
}
((ViewHandler<IPicker, SkiaPicker>)(object)handler).PlatformView.Invalidate();
}
}
private void ReloadItems()
{
if (PlatformView is null || VirtualView is null) return;
public static void MapCharacterSpacing(PickerHandler handler, IPicker picker)
{
}
var items = VirtualView.GetItemsAsArray();
PlatformView.SetItems(items.Select(i => i?.ToString() ?? ""));
}
public static void MapHorizontalTextAlignment(PickerHandler handler, IPicker picker)
{
}
public static void MapTitle(PickerHandler handler, IPicker picker)
{
if (handler.PlatformView is null) return;
handler.PlatformView.Title = picker.Title ?? "";
}
public static void MapVerticalTextAlignment(PickerHandler handler, IPicker picker)
{
}
public static void MapTitleColor(PickerHandler handler, IPicker picker)
{
if (handler.PlatformView is null) return;
if (picker.TitleColor is not null)
{
handler.PlatformView.TitleColor = picker.TitleColor.ToSKColor();
}
}
public static void MapBackground(PickerHandler handler, IPicker picker)
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
if (((ViewHandler<IPicker, SkiaPicker>)(object)handler).PlatformView != null)
{
Paint background = ((IView)picker).Background;
SolidPaint val = (SolidPaint)(object)((background is SolidPaint) ? background : null);
if (val != null && val.Color != null)
{
((ViewHandler<IPicker, SkiaPicker>)(object)handler).PlatformView.BackgroundColor = val.Color.ToSKColor();
}
}
}
public static void MapSelectedIndex(PickerHandler handler, IPicker picker)
{
if (handler.PlatformView is null) return;
handler.PlatformView.SelectedIndex = picker.SelectedIndex;
}
public static void MapItemsSource(PickerHandler handler, IPicker picker)
{
handler.ReloadItems();
}
public static void MapTextColor(PickerHandler handler, IPicker picker)
{
if (handler.PlatformView is null) return;
if (picker.TextColor is not null)
{
handler.PlatformView.TextColor = picker.TextColor.ToSKColor();
}
}
public static void MapCharacterSpacing(PickerHandler handler, IPicker picker)
{
// Character spacing could be implemented with custom text rendering
}
public static void MapHorizontalTextAlignment(PickerHandler handler, IPicker picker)
{
// Text alignment would require changes to SkiaPicker drawing
}
public static void MapVerticalTextAlignment(PickerHandler handler, IPicker picker)
{
// Text alignment would require changes to SkiaPicker drawing
}
public static void MapBackground(PickerHandler handler, IPicker picker)
{
if (handler.PlatformView is null) return;
if (picker.Background is SolidPaint solidPaint && solidPaint.Color is not null)
{
handler.PlatformView.BackgroundColor = solidPaint.Color.ToSKColor();
}
}
public static void MapItemsSource(PickerHandler handler, IPicker picker)
{
handler.ReloadItems();
}
}