Files
Ursa.Avalonia/demo/Ursa.Demo/ViewModels/PaginationDemoViewModel.cs
Soar360 74ad5f4111 为 Pagination 控件增加 CurrentPageChanged 事件
为 Pagination 控件增加 Command 属性
为 Pagination 控件增加 Command 属性的使用 Demo
2024-03-23 14:46:32 +08:00

25 lines
674 B
C#

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 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}");
}
}