diff --git a/src/AtomUI.Controls/Flyouts/MenuFlyout.cs b/src/AtomUI.Controls/Flyouts/MenuFlyout.cs index cef0cdea2..8bccd0bfd 100644 --- a/src/AtomUI.Controls/Flyouts/MenuFlyout.cs +++ b/src/AtomUI.Controls/Flyouts/MenuFlyout.cs @@ -65,10 +65,11 @@ public class MenuFlyout : Flyout { _presenter = new MenuFlyoutPresenter { - ItemsSource = Items, - [!ItemsControl.ItemTemplateProperty] = this[!ItemTemplateProperty], - [!ItemsControl.ItemContainerThemeProperty] = this[!ItemContainerThemeProperty], - MenuFlyout = this + ItemsSource = Items, + [!ItemsControl.ItemTemplateProperty] = this[!ItemTemplateProperty], + [!ItemsControl.ItemContainerThemeProperty] = this[!ItemContainerThemeProperty], + [!MenuFlyoutPresenter.IsMotionEnabledProperty] = this[!IsMotionEnabledProperty], + MenuFlyout = this }; BindUtils.RelayBind(this, IsShowArrowEffectiveProperty, _presenter, MenuFlyoutPresenter.IsShowArrowProperty); BindUtils.RelayBind(this, IsMotionEnabledProperty, _presenter, MenuFlyoutPresenter.IsMotionEnabledProperty); diff --git a/src/AtomUI.Controls/GeneratedFiles/AtomUI.Generator/AtomUI.Generator.TokenResourceKeyGenerator/TokenResourceConst.g.cs b/src/AtomUI.Controls/GeneratedFiles/AtomUI.Generator/AtomUI.Generator.TokenResourceKeyGenerator/TokenResourceConst.g.cs index deb96c29e..b15e8430c 100644 --- a/src/AtomUI.Controls/GeneratedFiles/AtomUI.Generator/AtomUI.Generator.TokenResourceKeyGenerator/TokenResourceConst.g.cs +++ b/src/AtomUI.Controls/GeneratedFiles/AtomUI.Generator/AtomUI.Generator.TokenResourceKeyGenerator/TokenResourceConst.g.cs @@ -88,18 +88,6 @@ namespace AtomUI.Theme.Styling public static readonly TokenResourceKey TextFontWeight = new TokenResourceKey("Badge.TextFontWeight"); } - public static class ButtonSpinnerTokenKey - { - public static readonly TokenResourceKey ControlWidth = new TokenResourceKey("ButtonSpinner.ControlWidth"); - public static readonly TokenResourceKey FilledHandleBg = new TokenResourceKey("ButtonSpinner.FilledHandleBg"); - public static readonly TokenResourceKey HandleActiveBg = new TokenResourceKey("ButtonSpinner.HandleActiveBg"); - public static readonly TokenResourceKey HandleBg = new TokenResourceKey("ButtonSpinner.HandleBg"); - public static readonly TokenResourceKey HandleBorderColor = new TokenResourceKey("ButtonSpinner.HandleBorderColor"); - public static readonly TokenResourceKey HandleHoverColor = new TokenResourceKey("ButtonSpinner.HandleHoverColor"); - public static readonly TokenResourceKey HandleIconSize = new TokenResourceKey("ButtonSpinner.HandleIconSize"); - public static readonly TokenResourceKey HandleWidth = new TokenResourceKey("ButtonSpinner.HandleWidth"); - } - public static class ButtonTokenKey { public static readonly TokenResourceKey BorderColorDisabled = new TokenResourceKey("Button.BorderColorDisabled"); @@ -151,6 +139,18 @@ namespace AtomUI.Theme.Styling public static readonly TokenResourceKey TextHoverBg = new TokenResourceKey("Button.TextHoverBg"); } + public static class ButtonSpinnerTokenKey + { + public static readonly TokenResourceKey ControlWidth = new TokenResourceKey("ButtonSpinner.ControlWidth"); + public static readonly TokenResourceKey FilledHandleBg = new TokenResourceKey("ButtonSpinner.FilledHandleBg"); + public static readonly TokenResourceKey HandleActiveBg = new TokenResourceKey("ButtonSpinner.HandleActiveBg"); + public static readonly TokenResourceKey HandleBg = new TokenResourceKey("ButtonSpinner.HandleBg"); + public static readonly TokenResourceKey HandleBorderColor = new TokenResourceKey("ButtonSpinner.HandleBorderColor"); + public static readonly TokenResourceKey HandleHoverColor = new TokenResourceKey("ButtonSpinner.HandleHoverColor"); + public static readonly TokenResourceKey HandleIconSize = new TokenResourceKey("ButtonSpinner.HandleIconSize"); + public static readonly TokenResourceKey HandleWidth = new TokenResourceKey("ButtonSpinner.HandleWidth"); + } + public static class CalendarTokenKey { public static readonly TokenResourceKey CellActiveWithRangeBg = new TokenResourceKey("Calendar.CellActiveWithRangeBg"); diff --git a/src/AtomUI.Controls/Menu/Themes/MenuItemTheme.axaml b/src/AtomUI.Controls/Menu/Themes/MenuItemTheme.axaml index e40cf584c..93250f0a9 100644 --- a/src/AtomUI.Controls/Menu/Themes/MenuItemTheme.axaml +++ b/src/AtomUI.Controls/Menu/Themes/MenuItemTheme.axaml @@ -75,6 +75,7 @@ IsLightDismissEnabled="False" IsDetectMouseClickEnabled="False" Placement="RightEdgeAlignedTop" + IsMotionEnabled="{TemplateBinding IsMotionEnabled}" IsMotionAwareOpen="{TemplateBinding IsSubMenuOpen, Mode=TwoWay}"> diff --git a/src/AtomUI.Controls/NavMenu/Themes/NavMenuItemTheme.axaml b/src/AtomUI.Controls/NavMenu/Themes/NavMenuItemTheme.axaml index 5c04fec95..b9e7a118a 100644 --- a/src/AtomUI.Controls/NavMenu/Themes/NavMenuItemTheme.axaml +++ b/src/AtomUI.Controls/NavMenu/Themes/NavMenuItemTheme.axaml @@ -52,6 +52,7 @@ IsLightDismissEnabled="False" IsDetectMouseClickEnabled="False" Placement="RightEdgeAlignedTop" + IsMotionEnabled="{TemplateBinding IsMotionEnabled}" IsMotionAwareOpen="{TemplateBinding IsSubMenuOpen, Mode=OneWay}"> diff --git a/src/AtomUI.Controls/Popup/Popup.cs b/src/AtomUI.Controls/Popup/Popup.cs index a6eb2226f..3cb1f7bf4 100644 --- a/src/AtomUI.Controls/Popup/Popup.cs +++ b/src/AtomUI.Controls/Popup/Popup.cs @@ -674,15 +674,17 @@ public class Popup : AvaloniaPopup, var shadowAwareLayer = _buddyLayer as IShadowAwareLayer; Debug.Assert(shadowAwareLayer != null); - - shadowAwareLayer.RunCloseMotion(null, () => + Dispatcher.UIThread.Post(() => { - _buddyLayer?.Detach(); - Close(); - closed?.Invoke(); - _closeAnimating = false; - _motionAwareOpened = false; - _isNeedDetectFlip = true; + shadowAwareLayer.RunCloseMotion(null, () => + { + _buddyLayer?.Detach(); + Close(); + closed?.Invoke(); + _closeAnimating = false; + _motionAwareOpened = false; + _isNeedDetectFlip = true; + }); }); } diff --git a/src/AtomUI.Controls/Popup/PopupBuddyLayer.cs b/src/AtomUI.Controls/Popup/PopupBuddyLayer.cs index a165e4696..a75268a5d 100644 --- a/src/AtomUI.Controls/Popup/PopupBuddyLayer.cs +++ b/src/AtomUI.Controls/Popup/PopupBuddyLayer.cs @@ -311,7 +311,6 @@ internal class PopupBuddyLayer : SceneLayer, IShadowAwareLayer { disposable.Dispose(); } - MotionActor?.UnFollow(); } public void RunOpenMotion(Action? aboutToStart = null, Action? completedAction = null) @@ -474,9 +473,9 @@ internal class PopupBuddyLayer : SceneLayer, IShadowAwareLayer if (_popupHost is PopupRoot popupRoot) { var popupMotionAction = popupRoot.FindDescendantOfType(); - if (popupMotionAction != null) + if (popupMotionAction != null && MotionActor != null) { - MotionActor?.Follow(popupMotionAction); + popupMotionAction.Follow(MotionActor); } } @@ -616,10 +615,6 @@ internal class PopupBuddyLayer : SceneLayer, IShadowAwareLayer Height = popupPresenter.DesiredSize.Height, }; _ghostContentPresenter.Opacity = 1.0; - Dispatcher.UIThread.Post(() => - { - popupPresenter.Opacity = 0.0; - }); } }