Missing backgroundcolor

This commit is contained in:
2026-01-17 03:10:29 +00:00
parent 5443c7c22a
commit aad915ad86
63 changed files with 177 additions and 143 deletions

View File

@@ -2,19 +2,29 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using Microsoft.Maui.Graphics;
using SkiaSharp;
namespace Microsoft.Maui.Platform;
/// <summary>
/// Represents an item in a swipe view. MAUI-compliant using Color types.
/// </summary>
public class SwipeItem
{
public string Text { get; set; } = string.Empty;
public string? IconSource { get; set; }
public SKColor BackgroundColor { get; set; } = new SKColor(33, 150, 243);
/// <summary>
/// Background color using MAUI Color type.
/// </summary>
public Color BackgroundColor { get; set; } = Color.FromRgb(33, 150, 243);
public SKColor TextColor { get; set; } = SKColors.White;
/// <summary>
/// Text color using MAUI Color type.
/// </summary>
public Color TextColor { get; set; } = Colors.White;
public event EventHandler? Invoked;
@@ -22,4 +32,22 @@ public class SwipeItem
{
Invoked?.Invoke(this, EventArgs.Empty);
}
/// <summary>
/// Helper to convert BackgroundColor to SKColor for rendering.
/// </summary>
internal SKColor GetBackgroundColorSK() => new SKColor(
(byte)(BackgroundColor.Red * 255),
(byte)(BackgroundColor.Green * 255),
(byte)(BackgroundColor.Blue * 255),
(byte)(BackgroundColor.Alpha * 255));
/// <summary>
/// Helper to convert TextColor to SKColor for rendering.
/// </summary>
internal SKColor GetTextColorSK() => new SKColor(
(byte)(TextColor.Red * 255),
(byte)(TextColor.Green * 255),
(byte)(TextColor.Blue * 255),
(byte)(TextColor.Alpha * 255));
}