feat: initial DualBadge.

This commit is contained in:
Zhang Dian
2023-07-26 10:20:13 +08:00
parent cde1caabd4
commit 82312e7477
15 changed files with 152 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
using Avalonia;
using Avalonia.Controls.Metadata;
using Avalonia.Controls.Presenters;
using Avalonia.Controls.Primitives;
using Avalonia.Controls.Templates;
using Avalonia.Media;
namespace Ursa.Controls;
[TemplatePart(PART_Icon, typeof(ContentPresenter))]
public class DualBadge : HeaderedContentControl
{
public const string PART_HeaderPresenter = "PART_HeaderPresenter";
public const string PART_ContentPresenter = "PART_ContentPresenter";
public const string PART_Icon = "PART_Icon";
public static readonly StyledProperty<object?> IconProperty =
AvaloniaProperty.Register<DualBadge, object?>(nameof(Icon));
public object? Icon
{
get => GetValue(IconProperty);
set => SetValue(IconProperty, value);
}
public static readonly StyledProperty<IDataTemplate?> IconTemplateProperty =
AvaloniaProperty.Register<DualBadge, IDataTemplate?>(nameof(IconTemplate));
public IDataTemplate? IconTemplate
{
get => GetValue(IconTemplateProperty);
set => SetValue(IconTemplateProperty, value);
}
public static readonly StyledProperty<IBrush?> HeaderForegroundProperty =
AvaloniaProperty.Register<DualBadge, IBrush?>(nameof(HeaderForeground));
public IBrush? HeaderForeground
{
get => GetValue(HeaderForegroundProperty);
set => SetValue(HeaderForegroundProperty, value);
}
public static readonly StyledProperty<IBrush?> HeaderBackgroundProperty =
AvaloniaProperty.Register<DualBadge, IBrush?>(nameof(HeaderBackground));
public IBrush? HeaderBackground
{
get => GetValue(HeaderBackgroundProperty);
set => SetValue(HeaderBackgroundProperty, value);
}
}