修复 Collapse bug

This commit is contained in:
polarboy 2024-08-30 15:29:56 +08:00
parent c6e207fcef
commit 2e2539e276
5 changed files with 10 additions and 8 deletions

View File

@ -19,7 +19,7 @@ public partial class CollapseShowCase : UserControl
{ {
InitializeComponent(); InitializeComponent();
DataContext = this; DataContext = this;
ExpandButtonPosGroup.OptionCheckedChanged += HandleExpandButtonPosOptionCheckedChanged; //ExpandButtonPosGroup.OptionCheckedChanged += HandleExpandButtonPosOptionCheckedChanged;
} }
private void HandleExpandButtonPosOptionCheckedChanged(object? sender, OptionCheckedChangedEventArgs args) private void HandleExpandButtonPosOptionCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)

View File

@ -276,8 +276,8 @@ internal class AlertTheme : BaseControlTheme
Name = CloseBtnPart, Name = CloseBtnPart,
}; };
TokenResourceBinder.CreateTokenBinding(closeBtn, IconButton.WidthProperty, GlobalTokenResourceKey.IconSizeSM); TokenResourceBinder.CreateTokenBinding(closeBtn, IconButton.IconWidthProperty, GlobalTokenResourceKey.IconSizeSM);
TokenResourceBinder.CreateTokenBinding(closeBtn, IconButton.HeightProperty, GlobalTokenResourceKey.IconSizeSM); TokenResourceBinder.CreateTokenBinding(closeBtn, IconButton.IconHeightProperty, GlobalTokenResourceKey.IconSizeSM);
TokenResourceBinder.CreateTokenBinding(closeBtn, IconButton.MarginProperty, AlertTokenResourceKey.ExtraElementMargin); TokenResourceBinder.CreateTokenBinding(closeBtn, IconButton.MarginProperty, AlertTokenResourceKey.ExtraElementMargin);
CreateTemplateParentBinding(closeBtn, IconButton.IsVisibleProperty, Alert.IsClosableProperty); CreateTemplateParentBinding(closeBtn, IconButton.IsVisibleProperty, Alert.IsClosableProperty);

View File

@ -45,7 +45,7 @@ internal class IconButtonTheme : BaseControlTheme
{ {
{ {
var contentStyle = new Style(selector => selector.Nesting().Template().Name(IconContentPart)); var contentStyle = new Style(selector => selector.Nesting().Template().Name(IconContentPart));
contentStyle.Add(ContentPresenter.BackgroundProperty, GlobalTokenResourceKey.ColorBgContainer); contentStyle.Add(ContentPresenter.BackgroundProperty, GlobalTokenResourceKey.ColorTransparent);
Add(contentStyle); Add(contentStyle);
} }
var enableHoverBgStyle = new Style(selector => selector.Nesting().PropertyEquals(IconButton.IsEnableHoverEffectProperty, true).Class(StdPseudoClass.PointerOver)); var enableHoverBgStyle = new Style(selector => selector.Nesting().PropertyEquals(IconButton.IsEnableHoverEffectProperty, true).Class(StdPseudoClass.PointerOver));

View File

@ -1,5 +1,7 @@
using AtomUI.Theme; using AtomUI.Data;
using AtomUI.Theme;
using AtomUI.Theme.Styling; using AtomUI.Theme.Styling;
using Avalonia;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Controls.Presenters; using Avalonia.Controls.Presenters;
using Avalonia.Controls.Templates; using Avalonia.Controls.Templates;
@ -23,7 +25,7 @@ internal class CollapseTheme : BaseControlTheme
var frameDecorator = new Border() var frameDecorator = new Border()
{ {
Name = FrameDecoratorPart, Name = FrameDecoratorPart,
ClipToBounds = true ClipToBounds = true,
}; };
var itemsPresenter = new ItemsPresenter() var itemsPresenter = new ItemsPresenter()
{ {

View File

@ -136,8 +136,8 @@ public class Expander : AvaloniaExpander
o => o.MotionDuration, o => o.MotionDuration,
(o, v) => o.MotionDuration = v); (o, v) => o.MotionDuration = v);
internal static readonly DirectProperty<Collapse, Thickness> EffectiveBorderThicknessProperty = internal static readonly DirectProperty<Expander, Thickness> EffectiveBorderThicknessProperty =
AvaloniaProperty.RegisterDirect<Collapse, Thickness>(nameof(EffectiveBorderThickness), AvaloniaProperty.RegisterDirect<Expander, Thickness>(nameof(EffectiveBorderThickness),
o => o.EffectiveBorderThickness, o => o.EffectiveBorderThickness,
(o, v) => o.EffectiveBorderThickness = v); (o, v) => o.EffectiveBorderThickness = v);