diff --git a/src/AtomUI.Controls/Card/Card.cs b/src/AtomUI.Controls/Card/Card.cs index 3483b3d69..82d72fc5e 100644 --- a/src/AtomUI.Controls/Card/Card.cs +++ b/src/AtomUI.Controls/Card/Card.cs @@ -154,6 +154,12 @@ public class Card : HeaderedContentControl, o => o.EffectiveBorderThickness, (o, v) => o.EffectiveBorderThickness = v); + internal static readonly DirectProperty ActionsPanelVisibleProperty = + AvaloniaProperty.RegisterDirect( + nameof(ActionsPanelVisible), + o => o.ActionsPanelVisible, + (o, v) => o.ActionsPanelVisible = v); + private Thickness _headerBorderThickness; internal Thickness HeaderBorderThickness @@ -170,6 +176,13 @@ public class Card : HeaderedContentControl, set => SetAndRaise(EffectiveBorderThicknessProperty, ref _effectiveBorderThickness, value); } + private bool _actionsPanelVisible; + + internal bool ActionsPanelVisible + { + get => _actionsPanelVisible; + set => SetAndRaise(ActionsPanelVisibleProperty, ref _actionsPanelVisible, value); + } #endregion private CardActionPanel? _cardActionPanel; @@ -318,5 +331,12 @@ public class Card : HeaderedContentControl, throw new NotSupportedException(); } } + SetCurrentValue(ActionsPanelVisibleProperty, Actions.Count > 0); } + + protected override Size MeasureOverride(Size availableSize) + { + return base.MeasureOverride(availableSize); + } + } \ No newline at end of file diff --git a/src/AtomUI.Controls/Card/Themes/CardTheme.axaml b/src/AtomUI.Controls/Card/Themes/CardTheme.axaml index 103f21680..fc3d6de1e 100644 --- a/src/AtomUI.Controls/Card/Themes/CardTheme.axaml +++ b/src/AtomUI.Controls/Card/Themes/CardTheme.axaml @@ -2,53 +2,63 @@ xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:atom="https://atomui.net" + xmlns:converters="using:Avalonia.Controls.Converters" x:ClassModifier="internal"> + - - - - - - - - - - + ClipToBounds="False" + BoxShadow="{TemplateBinding BoxShadow}"> + + + + + + + + + + - - - + HorizontalContentAlignment="Stretch" /> + + + + + - + @@ -56,27 +66,28 @@ - + - + - + - + - - - + - - - + - - + - + + + + \ No newline at end of file diff --git a/src/AtomUI.Controls/DatePicker/CalendarView/CalendarItem.cs b/src/AtomUI.Controls/DatePicker/CalendarView/CalendarItem.cs index 00011c16a..652fff0a2 100644 --- a/src/AtomUI.Controls/DatePicker/CalendarView/CalendarItem.cs +++ b/src/AtomUI.Controls/DatePicker/CalendarView/CalendarItem.cs @@ -4,7 +4,6 @@ using System.Reactive.Disposables; using AtomUI.Collections.Pooled; using AtomUI.Controls.Themes; using AtomUI.Data; -using AtomUI.Theme; using AtomUI.Theme.Data; using AtomUI.Theme.Styling; using Avalonia; @@ -15,7 +14,6 @@ using Avalonia.Data; using Avalonia.Input; using Avalonia.Input.Raw; using Avalonia.Interactivity; -using Avalonia.LogicalTree; using Avalonia.Media; namespace AtomUI.Controls.CalendarView; diff --git a/src/AtomUI.Controls/Skeleton/Skeleton.cs b/src/AtomUI.Controls/Skeleton/Skeleton.cs index 2c2d4ad7d..64681e95a 100644 --- a/src/AtomUI.Controls/Skeleton/Skeleton.cs +++ b/src/AtomUI.Controls/Skeleton/Skeleton.cs @@ -193,6 +193,7 @@ public class Skeleton : AbstractSkeleton, IControlSharedTokenResourcesHost { StartActiveAnimation(); } + IsContentVisible = !IsLoading && (Content != null || ContentTemplate != null); } protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change) @@ -205,4 +206,5 @@ public class Skeleton : AbstractSkeleton, IControlSharedTokenResourcesHost IsContentVisible = !IsLoading && (Content != null || ContentTemplate != null); } } + } \ No newline at end of file diff --git a/src/AtomUI.Controls/Skeleton/SkeletonLine.cs b/src/AtomUI.Controls/Skeleton/SkeletonLine.cs index 7caadc3bb..8f6c2159f 100644 --- a/src/AtomUI.Controls/Skeleton/SkeletonLine.cs +++ b/src/AtomUI.Controls/Skeleton/SkeletonLine.cs @@ -40,22 +40,25 @@ public class SkeletonLine : AbstractSkeleton { actualWidth = LineWidth.Value; } - else if (!double.IsInfinity(actualWidth)) - { - actualWidth = Math.Min(actualWidth, actualWidth * (LineWidth.Value / 100.0)); - } - var actualSize = new Size(actualWidth, availableSize.Height); - var size = base.MeasureOverride(actualSize); - return actualSize.WithHeight(size.Height); + return base.MeasureOverride(actualSize); } protected override Size ArrangeOverride(Size finalSize) { - var size = base.ArrangeOverride(finalSize); + var size = base.ArrangeOverride(finalSize); + var actualWidth = finalSize.Width; + if (!LineWidth.IsPixel) + { + if (!double.IsInfinity(actualWidth)) + { + actualWidth = Math.Min(actualWidth, actualWidth * (LineWidth.Value / 100.0)); + } + } + if (_rootLayout != null) { - _rootLayout.Arrange(new Rect(0, 0, DesiredSize.Width, DesiredSize.Height)); + _rootLayout.Arrange(new Rect(0, 0, actualWidth, DesiredSize.Height)); } return size; } diff --git a/src/AtomUI.Controls/Skeleton/Themes/AbstractSkeletonTheme.axaml b/src/AtomUI.Controls/Skeleton/Themes/AbstractSkeletonTheme.axaml index 5edd14a59..9168b8b97 100644 --- a/src/AtomUI.Controls/Skeleton/Themes/AbstractSkeletonTheme.axaml +++ b/src/AtomUI.Controls/Skeleton/Themes/AbstractSkeletonTheme.axaml @@ -22,6 +22,8 @@