From a366ca6f0ca7b3637ccfb23fe814e0af3ae4bc77 Mon Sep 17 00:00:00 2001 From: Zhang Dian <54255897+zdpcdt@users.noreply.github.com> Date: Fri, 17 Jan 2025 16:05:52 +0800 Subject: [PATCH] feat: using Padding instead of Gap in Avatar. --- demo/Ursa.Demo/Pages/AvatarDemo.axaml | 4 ++-- src/Ursa.Themes.Semi/Controls/Avatar.axaml | 15 +++++------- src/Ursa/Controls/Avatar/Avatar.cs | 9 -------- .../Converters/DoubleToThicknessConverter.cs | 23 ------------------- 4 files changed, 8 insertions(+), 43 deletions(-) delete mode 100644 src/Ursa/Converters/DoubleToThicknessConverter.cs diff --git a/demo/Ursa.Demo/Pages/AvatarDemo.axaml b/demo/Ursa.Demo/Pages/AvatarDemo.axaml index e401bfc..1524a7d 100644 --- a/demo/Ursa.Demo/Pages/AvatarDemo.axaml +++ b/demo/Ursa.Demo/Pages/AvatarDemo.axaml @@ -95,8 +95,8 @@ - - + + diff --git a/src/Ursa.Themes.Semi/Controls/Avatar.axaml b/src/Ursa.Themes.Semi/Controls/Avatar.axaml index b8cfc97..68a9b78 100644 --- a/src/Ursa.Themes.Semi/Controls/Avatar.axaml +++ b/src/Ursa.Themes.Semi/Controls/Avatar.axaml @@ -1,22 +1,20 @@  + xmlns:u="https://irihi.tech/ursa"> - - + + - - + @@ -32,10 +30,9 @@ BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{TemplateBinding CornerRadius}" - Background="{TemplateBinding Background}"> - + Background="{TemplateBinding Background}" /> GapProperty = AvaloniaProperty.Register( - nameof(Gap)); - public static readonly StyledProperty SourceProperty = AvaloniaProperty.Register( nameof(Source)); public static readonly StyledProperty HoverMaskProperty = AvaloniaProperty.Register( nameof(HoverMask)); - public double Gap - { - get => GetValue(GapProperty); - set => SetValue(GapProperty, value); - } - [ExcludeFromCodeCoverage] public IImage? Source { diff --git a/src/Ursa/Converters/DoubleToThicknessConverter.cs b/src/Ursa/Converters/DoubleToThicknessConverter.cs deleted file mode 100644 index 6ac248b..0000000 --- a/src/Ursa/Converters/DoubleToThicknessConverter.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Globalization; -using Avalonia; -using Avalonia.Data.Converters; - -namespace Ursa.Converters; - -public class DoubleToThicknessConverter : IValueConverter -{ - public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) - { - if (value is double d) - { - return new Thickness(d, 0); - } - - return AvaloniaProperty.UnsetValue; - } - - public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } -} \ No newline at end of file