Fix Simple Pagination bug

This commit is contained in:
chinboy
2025-07-23 17:23:05 +08:00
parent c1d503a959
commit 8a8e47548b
6 changed files with 19 additions and 33 deletions
@@ -33,6 +33,8 @@ public class ComboBoxItem : AvaloniaComboBoxItem
}
#endregion
protected override Type StyleKeyOverride { get; } = typeof(ComboBoxItem);
private void ConfigureTransitions()
{
if (IsMotionEnabled)
@@ -86,6 +86,10 @@
</Style>
</Style>
</Style>
<Style Selector="^:disabled">
<Setter Property="Foreground"
Value="{DynamicResource {x:Static atom:SharedTokenKey.ColorTextDisabled}}" />
</Style>
</Style>
</ControlTheme>
</ResourceDictionary>
@@ -1,33 +1,6 @@
using System.Reactive.Disposables;
using AtomUI.Theme;
using AtomUI.Theme.Data;
using Avalonia.LogicalTree;
namespace AtomUI.Controls;
internal class PageSizeComboBoxItem : ComboBoxItem,
IResourceBindingManager
internal class PageSizeComboBoxItem : ComboBoxItem
{
public int PageSize { get; set; }
private CompositeDisposable? _resourceBindingsDisposable;
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
{
get => _resourceBindingsDisposable;
set => _resourceBindingsDisposable = value;
}
protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e)
{
base.OnAttachedToLogicalTree(e);
_resourceBindingsDisposable = new CompositeDisposable();
this.AddResourceBindingDisposable(
TokenResourceBinder.CreateTokenBinding(this, ThemeProperty, typeof(ComboBoxItem)));
}
protected override void OnDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs e)
{
base.OnDetachedFromLogicalTree(e);
this.DisposeTokenBindings();
}
}
@@ -10,8 +10,7 @@ using Avalonia.Interactivity;
namespace AtomUI.Controls;
public class SimplePagination : AbstractPagination,
IControlSharedTokenResourcesHost
public class SimplePagination : AbstractPagination, IControlSharedTokenResourcesHost
{
#region 公共属性定义
@@ -102,6 +101,7 @@ public class SimplePagination : AbstractPagination,
if (sender is PaginationNavItem navItemSender)
{
CurrentPage = navItemSender.PageNumber;
HandlePageConditionChanged();
}
}
@@ -49,5 +49,9 @@
<Setter Property="Spacing" Value="{DynamicResource {x:Static atom:PaginationTokenKey.PaginationLayoutMiniSpacing}}"/>
</Style>
</Style>
<Style Selector="^:disabled">
<Setter Property="Foreground"
Value="{DynamicResource {x:Static atom:PaginationTokenKey.ItemActiveColorDisabled}}" />
</Style>
</ControlTheme>
</ResourceDictionary>
@@ -12,11 +12,13 @@
PaginationItemType="Previous"
Content="{atom:IconProvider LeftOutlined}"
SizeType="{TemplateBinding SizeType}"
IsEnabled="{TemplateBinding IsEnabled}" />
IsEnabled="{TemplateBinding IsEnabled}"
IsMotionEnabled="{TemplateBinding IsMotionEnabled}"/>
<atom:LineEdit Name="{x:Static atom:SimplePaginationThemeConstants.QuickJumperPart}"
IsVisible="{TemplateBinding IsReadOnly, Mode=Default, Converter={x:Static BoolConverters.Not}}"
SizeType="{TemplateBinding SizeType}"
IsEnabled="{TemplateBinding IsEnabled}" />
IsEnabled="{TemplateBinding IsEnabled}"
IsMotionEnabled="{TemplateBinding IsMotionEnabled}"/>
<atom:TextBlock Name="{x:Static atom:SimplePaginationThemeConstants.InfoIndicatorPart}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
@@ -25,7 +27,8 @@
PaginationItemType="Previous"
Content="{atom:IconProvider RightOutlined}"
SizeType="{TemplateBinding SizeType}"
IsEnabled="{TemplateBinding IsEnabled}" />
IsEnabled="{TemplateBinding IsEnabled}"
IsMotionEnabled="{TemplateBinding IsMotionEnabled}"/>
</StackPanel>
</ControlTemplate>
</Setter>