feat: initialize.

This commit is contained in:
Zhang Dian
2024-06-15 21:57:10 +08:00
parent 8ae57f4a5b
commit 4e6e2a083a
15 changed files with 119 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa">
<ControlTheme x:Key="{x:Type u:Avatar}" TargetType="{x:Type u:Avatar}" />
<ControlTheme x:Key="{x:Type u:AvatarGroup}" TargetType="{x:Type u:AvatarGroup}" />
</ResourceDictionary>

View File

@@ -1,6 +1,7 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- Add Resources Here -->
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="Avatar.axaml" />
<ResourceInclude Source="Badge.axaml" />
<ResourceInclude Source="Banner.axaml" />
<ResourceInclude Source="ButtonGroup.axaml" />

View File

@@ -0,0 +1,2 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary>

View File

@@ -1,6 +1,7 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- Add Resources Here -->
<ResourceDictionary.MergedDictionaries>
<MergeResourceInclude Source="Avatar.axaml" />
<MergeResourceInclude Source="Badge.axaml" />
<MergeResourceInclude Source="Banner.axaml" />
<MergeResourceInclude Source="ButtonGroup.axaml" />

View File

@@ -0,0 +1,2 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary>

View File

@@ -1,6 +1,7 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- Add Resources Here -->
<ResourceDictionary.MergedDictionaries>
<MergeResourceInclude Source="Avatar.axaml" />
<MergeResourceInclude Source="Badge.axaml" />
<MergeResourceInclude Source="Banner.axaml" />
<MergeResourceInclude Source="ButtonGroup.axaml" />

View File

@@ -0,0 +1,2 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary>

View File

@@ -1,6 +1,7 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- Add Resources Here -->
<ResourceDictionary.MergedDictionaries>
<MergeResourceInclude Source="Avatar.axaml" />
<MergeResourceInclude Source="Badge.axaml" />
<MergeResourceInclude Source="Banner.axaml" />
<MergeResourceInclude Source="ButtonGroup.axaml" />

View File

@@ -0,0 +1,38 @@
using Avalonia;
using Avalonia.Controls;
namespace Ursa.Controls;
public class Avatar : Button
{
public const string PART_TopPresenter = "PART_TopPresenter";
public const string PART_BottomPresenter = "PART_BottomPresenter";
public const string PART_HoverMask = "PART_HoverMask";
public static readonly StyledProperty<bool> ContentMotionProperty = AvaloniaProperty.Register<Avatar, bool>(
nameof(ContentMotion));
public static readonly StyledProperty<double> GapProperty = AvaloniaProperty.Register<Avatar, double>(
nameof(Gap));
public static readonly StyledProperty<string> SourceProperty = AvaloniaProperty.Register<Avatar, string>(
nameof(Source));
public bool ContentMotion
{
get => GetValue(ContentMotionProperty);
set => SetValue(ContentMotionProperty, value);
}
public double Gap
{
get => GetValue(GapProperty);
set => SetValue(GapProperty, value);
}
public string Source
{
get => GetValue(SourceProperty);
set => SetValue(SourceProperty, value);
}
}

View File

@@ -0,0 +1,33 @@
using Avalonia;
using Avalonia.Controls;
namespace Ursa.Controls;
public class AvatarGroup : ItemsControl
{
public const string PART_RenderMore = "PART_RenderMore";
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 int MaxCount
{
get => GetValue(MaxCountProperty);
set => SetValue(MaxCountProperty, value);
}
public OverlapFromType OverlapFrom
{
get => GetValue(OverlapFromProperty);
set => SetValue(OverlapFromProperty, value);
}
}
public enum OverlapFromType
{
Start,
End
}