feat: simple avatar group.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Templates;
|
||||
using Avalonia.Layout;
|
||||
|
||||
namespace Ursa.Controls;
|
||||
|
||||
@@ -7,11 +9,15 @@ public class AvatarGroup : ItemsControl
|
||||
{
|
||||
public const string PART_RenderMore = "PART_RenderMore";
|
||||
|
||||
private static readonly FuncTemplate<Panel?> DefaultPanel =
|
||||
new(() => new StackPanel { Orientation = Orientation.Horizontal });
|
||||
|
||||
public static readonly StyledProperty<int> MaxCountProperty = AvaloniaProperty.Register<AvatarGroup, int>(
|
||||
nameof(MaxCount));
|
||||
|
||||
public static readonly StyledProperty<OverlapFromType> OverlapFromProperty = AvaloniaProperty.Register<AvatarGroup, OverlapFromType>(
|
||||
nameof(OverlapFrom));
|
||||
public static readonly StyledProperty<OverlapFromType> OverlapFromProperty =
|
||||
AvaloniaProperty.Register<AvatarGroup, OverlapFromType>(
|
||||
nameof(OverlapFrom));
|
||||
|
||||
public int MaxCount
|
||||
{
|
||||
@@ -24,6 +30,11 @@ public class AvatarGroup : ItemsControl
|
||||
get => GetValue(OverlapFromProperty);
|
||||
set => SetValue(OverlapFromProperty, value);
|
||||
}
|
||||
|
||||
static AvatarGroup()
|
||||
{
|
||||
ItemsPanelProperty.OverrideDefaultValue<AvatarGroup>(DefaultPanel);
|
||||
}
|
||||
}
|
||||
|
||||
public enum OverlapFromType
|
||||
|
||||
Reference in New Issue
Block a user