From ec539737edbf3ec98c6aec256d3aada2d3fb5574 Mon Sep 17 00:00:00 2001 From: chinboy Date: Fri, 14 Feb 2025 14:50:34 +0800 Subject: [PATCH] Refactor NumericUpDown --- .../NumericUpDown/NumericUpDown.cs | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/src/AtomUI.Controls/NumericUpDown/NumericUpDown.cs b/src/AtomUI.Controls/NumericUpDown/NumericUpDown.cs index 779967254..67b02b7e0 100644 --- a/src/AtomUI.Controls/NumericUpDown/NumericUpDown.cs +++ b/src/AtomUI.Controls/NumericUpDown/NumericUpDown.cs @@ -1,10 +1,14 @@ -using Avalonia; +using AtomUI.Theme; +using Avalonia; +using Avalonia.Controls; namespace AtomUI.Controls; using AvaloniaNumericUpDown = Avalonia.Controls.NumericUpDown; -public class NumericUpDown : AvaloniaNumericUpDown +public class NumericUpDown : AvaloniaNumericUpDown, + IAnimationAwareControl, + IControlSharedTokenResourcesHost { #region 公共属性定义 @@ -25,6 +29,12 @@ public class NumericUpDown : AvaloniaNumericUpDown public static readonly StyledProperty IsEnableClearButtonProperty = TextBox.IsEnableClearButtonProperty.AddOwner(); + + public static readonly StyledProperty IsMotionEnabledProperty + = AvaloniaProperty.Register(nameof(IsMotionEnabled), true); + + public static readonly StyledProperty IsWaveAnimationEnabledProperty + = AvaloniaProperty.Register(nameof(IsWaveAnimationEnabled), true); public object? LeftAddOn { @@ -61,6 +71,26 @@ public class NumericUpDown : AvaloniaNumericUpDown get => GetValue(IsEnableClearButtonProperty); set => SetValue(IsEnableClearButtonProperty, value); } + + public bool IsMotionEnabled + { + get => GetValue(IsMotionEnabledProperty); + set => SetValue(IsMotionEnabledProperty, value); + } + + public bool IsWaveAnimationEnabled + { + get => GetValue(IsWaveAnimationEnabledProperty); + set => SetValue(IsWaveAnimationEnabledProperty, value); + } #endregion + + #region 内部属性定义 + + Control IAnimationAwareControl.PropertyBindTarget => this; + Control IControlSharedTokenResourcesHost.HostControl => this; + string IControlSharedTokenResourcesHost.TokenId => NumericUpDownToken.ID; + + #endregion } \ No newline at end of file