Files
maui-linux/Views/SwipeItem.cs

46 lines
1.2 KiB
C#
Raw Normal View History

// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
2026-01-17 03:10:29 +00:00
using Microsoft.Maui.Graphics;
using SkiaSharp;
namespace Microsoft.Maui.Platform;
2026-01-17 03:10:29 +00:00
/// <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; }
2026-01-17 03:10:29 +00:00
/// <summary>
/// Background color using MAUI Color type.
/// </summary>
public Color BackgroundColor { get; set; } = Color.FromRgb(33, 150, 243);
2026-01-17 03:10:29 +00:00
/// <summary>
/// Text color using MAUI Color type.
/// </summary>
public Color TextColor { get; set; } = Colors.White;
public event EventHandler? Invoked;
internal void OnInvoked()
{
Invoked?.Invoke(this, EventArgs.Empty);
}
2026-01-17 03:10:29 +00:00
/// <summary>
/// Helper to convert BackgroundColor to SKColor for rendering.
/// </summary>
2026-01-17 03:36:37 +00:00
internal SKColor GetBackgroundColorSK() => BackgroundColor.ToSKColor();
2026-01-17 03:10:29 +00:00
/// <summary>
/// Helper to convert TextColor to SKColor for rendering.
/// </summary>
2026-01-17 03:36:37 +00:00
internal SKColor GetTextColorSK() => TextColor.ToSKColor();
}