Semi.Avalonia/demo/Semi.Avalonia.Demo/Controls/FunctionalColorGroupControl.cs

41 lines
1.4 KiB
C#
Raw Normal View History

2023-02-13 02:17:38 +08:00
using System.Collections;
using Avalonia;
using Avalonia.Controls.Primitives;
namespace Semi.Avalonia.Demo.Controls;
2024-11-15 01:00:59 +08:00
public class FunctionalColorGroupControl : TemplatedControl
2023-02-13 02:17:38 +08:00
{
2024-11-15 01:00:59 +08:00
public static readonly StyledProperty<string?> TitleProperty =
AvaloniaProperty.Register<FunctionalColorGroupControl, string?>(nameof(Title));
2023-02-13 02:17:38 +08:00
public string? Title
{
get => GetValue(TitleProperty);
set => SetValue(TitleProperty, value);
}
2024-11-15 01:00:59 +08:00
public static readonly DirectProperty<FunctionalColorGroupControl, IEnumerable?> LightColorsProperty =
AvaloniaProperty.RegisterDirect<FunctionalColorGroupControl, IEnumerable?>(nameof(LightColors),
o => o.LightColors, (o, v) => o.LightColors = v);
2023-03-26 19:38:12 +08:00
private IEnumerable? _lightColors;
2024-11-15 01:00:59 +08:00
2023-03-26 19:38:12 +08:00
public IEnumerable? LightColors
2023-02-13 02:17:38 +08:00
{
get => _lightColors;
set => SetAndRaise(LightColorsProperty, ref _lightColors, value);
}
2024-11-15 01:00:59 +08:00
public static readonly DirectProperty<FunctionalColorGroupControl, IEnumerable?> DarkColorsProperty =
AvaloniaProperty.RegisterDirect<FunctionalColorGroupControl, IEnumerable?>(nameof(DarkColors),
o => o.DarkColors, (o, v) => o.DarkColors = v);
2023-03-26 19:38:12 +08:00
private IEnumerable? _darkColors;
2024-11-15 01:00:59 +08:00
2023-03-26 19:38:12 +08:00
public IEnumerable? DarkColors
2023-02-13 02:17:38 +08:00
{
get => _darkColors;
set => SetAndRaise(DarkColorsProperty, ref _darkColors, value);
}
}