diff --git a/src/AtomUI.Controls/DatePicker/DatePicker.cs b/src/AtomUI.Controls/DatePicker/DatePicker.cs index e3a091b9b..5d7a0a849 100644 --- a/src/AtomUI.Controls/DatePicker/DatePicker.cs +++ b/src/AtomUI.Controls/DatePicker/DatePicker.cs @@ -285,7 +285,7 @@ public class DatePicker : InfoPickerInput, } else { - var text = FormatDateTime(DateTime.Today); + var text = FormatDateTime(DateTime.Today); var preferredInputWidth = TextUtils.CalculateTextSize(text, FontSize, FontFamily, FontStyle, FontWeight).Width; if (Watermark != null) { @@ -293,6 +293,8 @@ public class DatePicker : InfoPickerInput, TextUtils.CalculateTextSize(Watermark, FontSize, FontFamily, FontStyle, FontWeight).Width); } + preferredInputWidth *= 1.1; + if (!double.IsNaN(MinWidth)) { preferredInputWidth = Math.Max(MinWidth, preferredInputWidth); diff --git a/src/AtomUI.Controls/DatePicker/RangeDatePicker.cs b/src/AtomUI.Controls/DatePicker/RangeDatePicker.cs index e472490b6..7e0615661 100644 --- a/src/AtomUI.Controls/DatePicker/RangeDatePicker.cs +++ b/src/AtomUI.Controls/DatePicker/RangeDatePicker.cs @@ -458,12 +458,12 @@ public class RangeDatePicker : RangeInfoPickerInput, if (PickerInnerBox is not null) { var preferredWidth = 0d; - // if (PickerInnerBox.RightAddOnContent is Control rightAddOnContent) - // { - // preferredWidth += PreferredWidth + rightAddOnContent.DesiredSize.Width + - // PickerInnerBox.EffectiveInnerBoxPadding.Left + - // PickerInnerBox.EffectiveInnerBoxPadding.Right; - // } + if (DecoratedBox?.ContentRightAddOn is Control rightAddOnContent) + { + preferredWidth += PreferredWidth + rightAddOnContent.DesiredSize.Width + + PickerInnerBox.Padding.Left + + PickerInnerBox.Padding.Right; + } if (RangePickerArrow is not null) { diff --git a/src/AtomUI.Controls/Primitives/AddOnDecoratedBox/AddOnDecoratedBox.cs b/src/AtomUI.Controls/Primitives/AddOnDecoratedBox/AddOnDecoratedBox.cs index 087ce69e4..b96f71928 100644 --- a/src/AtomUI.Controls/Primitives/AddOnDecoratedBox/AddOnDecoratedBox.cs +++ b/src/AtomUI.Controls/Primitives/AddOnDecoratedBox/AddOnDecoratedBox.cs @@ -234,12 +234,12 @@ internal class AddOnDecoratedBox : ContentControl, Control IMotionAwareControl.PropertyBindTarget => this; #endregion - - private Border? _contentFrame; - private IDisposable? _borderThicknessDisposable; + private IDisposable? _borderThicknessDisposable; private protected Control? _leftAddOn; private protected Control? _rightAddOn; + + internal Border? ContentFrame; static AddOnDecoratedBox() { @@ -362,16 +362,16 @@ internal class AddOnDecoratedBox : ContentControl, protected override void OnApplyTemplate(TemplateAppliedEventArgs e) { base.OnApplyTemplate(e); - _contentFrame = e.NameScope.Find(AddOnDecoratedBoxThemeConstants.ContentFramePart); + ContentFrame = e.NameScope.Find(AddOnDecoratedBoxThemeConstants.ContentFramePart); _leftAddOn = e.NameScope.Find(AddOnDecoratedBoxThemeConstants.LeftAddOnPart); _rightAddOn = e.NameScope.Find(AddOnDecoratedBoxThemeConstants.RightAddOnPart); - if (_contentFrame != null) + if (ContentFrame != null) { - _contentFrame.PointerEntered += (sender, args) => + ContentFrame.PointerEntered += (sender, args) => { IsInnerBoxHover = true; }; - _contentFrame.PointerExited += (sender, args) => + ContentFrame.PointerExited += (sender, args) => { IsInnerBoxHover = false; }; @@ -424,4 +424,5 @@ internal class AddOnDecoratedBox : ContentControl, bottomLeft: bottomLeftRadius, bottomRight: bottomRightRadius); } + } \ No newline at end of file diff --git a/src/AtomUI.Controls/Primitives/AddOnDecoratedBox/Themes/AddOnDecoratedBoxTheme.axaml b/src/AtomUI.Controls/Primitives/AddOnDecoratedBox/Themes/AddOnDecoratedBoxTheme.axaml index 4e72cb39a..338bf8413 100644 --- a/src/AtomUI.Controls/Primitives/AddOnDecoratedBox/Themes/AddOnDecoratedBoxTheme.axaml +++ b/src/AtomUI.Controls/Primitives/AddOnDecoratedBox/Themes/AddOnDecoratedBoxTheme.axaml @@ -87,7 +87,7 @@