From 8461ecee78f5df5aee58424c4ab5c4f584426411 Mon Sep 17 00:00:00 2001 From: chinboy Date: Tue, 8 Jul 2025 17:10:54 +0800 Subject: [PATCH] Fix button theme setup bug --- src/AtomUI.Controls/Buttons/Button.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/AtomUI.Controls/Buttons/Button.cs b/src/AtomUI.Controls/Buttons/Button.cs index 3988bfcf2..e35e6cb7c 100644 --- a/src/AtomUI.Controls/Buttons/Button.cs +++ b/src/AtomUI.Controls/Buttons/Button.cs @@ -379,17 +379,20 @@ public class Button : AvaloniaButton, { SetupShadows(); } - else if (e.Property == ButtonTypeProperty) - { - SetupControlThemeBindings(); - } else if (e.Property == IsMotionEnabledProperty || e.Property == IsWaveSpiritEnabledProperty) { ConfigureTransitions(); } } - + + if (this.IsAttachedToLogicalTree()) + { + if (e.Property == ButtonTypeProperty) + { + SetupControlThemeBindings(); + } + } } protected virtual void SetupControlThemeBindings()