Fix Expander expand icon position bug

This commit is contained in:
chinboy
2025-03-07 11:25:55 +08:00
parent 2445474bce
commit 3ee60f07bb
5 changed files with 23 additions and 20 deletions
+21 -10
View File
@@ -278,6 +278,14 @@ public class Expander : AvaloniaExpander,
}
}
if (this.IsAttachedToVisualTree())
{
if (change.Property == IsBorderlessProperty)
{
SetupEffectiveBorderThickness();
}
}
if (change.Property == ExpandIconProperty)
{
if (change.OldValue is Icon oldIcon)
@@ -290,16 +298,7 @@ public class Expander : AvaloniaExpander,
newIcon.SetTemplatedParent(this);
}
}
if (this.IsAttachedToVisualTree())
{
if (change.Property == IsBorderlessProperty)
{
SetupEffectiveBorderThickness();
}
}
if (change.Property == IsExpandedProperty)
else if (change.Property == IsExpandedProperty)
{
HandleExpandedChanged();
}
@@ -310,6 +309,18 @@ public class Expander : AvaloniaExpander,
{
SetupExpanderBorderThickness();
}
else if (change.Property == AddOnContentProperty)
{
if (change.OldValue is Control oldControl)
{
oldControl.SetTemplatedParent(null);
}
if (change.NewValue is Control newControl)
{
newControl.SetTemplatedParent(this);
}
}
}
private void SetupDefaultIcon()
@@ -1,6 +1,5 @@
using AtomUI.IconPkg;
using AtomUI.Theme;
using AtomUI.Theme.Data;
using AtomUI.Theme.Styling;
using Avalonia;
using Avalonia.Controls;
@@ -3,7 +3,6 @@ using AtomUI.Data;
using AtomUI.Theme;
using AtomUI.Theme.Data;
using AtomUI.Theme.Styling;
using AtomUI.Utils;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Presenters;
@@ -1,7 +1,4 @@
using AtomUI.IconPkg;
using AtomUI.IconPkg.AntDesign;
using AtomUI.Theme;
using AtomUI.Theme.Data;
using AtomUI.IconPkg.AntDesign;
using AtomUI.Theme.Styling;
using Avalonia;
using Avalonia.Controls;
@@ -1,7 +1,4 @@
using AtomUI.Theme;
using AtomUI.Theme.Data;
using AtomUI.Theme.Styling;
using AtomUI.Utils;
using AtomUI.Theme.Styling;
using Avalonia.Controls;
using Avalonia.Controls.Presenters;
using Avalonia.Controls.Templates;