Merge pull request #182 from Soar360/main
为 Pagination 控件增加 CurrentPageChanged 事件
This commit is contained in:
@@ -24,6 +24,8 @@
|
||||
PageSizeOptions="10, 20, 50, 100"
|
||||
ShowQuickJump="{Binding #quickJumperSelector.IsChecked}"
|
||||
ShowPageSizeSelector="{Binding #pageSizeSelector.IsChecked}"
|
||||
Command="{Binding LoadPageCommand}"
|
||||
CommandParameter="{Binding $self.CurrentPage}"
|
||||
TotalCount="600" />
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
||||
@@ -1,11 +1,25 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Input;
|
||||
using Avalonia.Collections;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
|
||||
namespace Ursa.Demo.ViewModels;
|
||||
|
||||
public class PaginationDemoViewModel: ViewModelBase
|
||||
public class PaginationDemoViewModel : ViewModelBase
|
||||
{
|
||||
public AvaloniaList<int> PageSizes { get; set; } = new() { 10, 20, 50, 100 };
|
||||
|
||||
public ICommand LoadPageCommand { get; }
|
||||
public PaginationDemoViewModel()
|
||||
{
|
||||
this.LoadPageCommand = new RelayCommand<int?>(LoadPage);
|
||||
}
|
||||
|
||||
private void LoadPage(int? pageIndex)
|
||||
{
|
||||
Debug.WriteLine($"Loading page {pageIndex}");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user