using System; using System.Collections.Generic; using System.Linq; using Avalonia; using Avalonia.Controls; using Avalonia.Controls.Metadata; using Avalonia.Controls.Primitives; using Avalonia.Input; using Avalonia.Interactivity; using ReactiveUI; namespace Artemis.UI.Shared.Pagination; /// /// Represents a pagination control that can be used to switch between pages. /// [TemplatePart("PART_PreviousButton", typeof(Button))] [TemplatePart("PART_NextButton", typeof(Button))] [TemplatePart("PART_PagesView", typeof(StackPanel))] public partial class Pagination : TemplatedControl { /// public Pagination() { PropertyChanged += OnPropertyChanged; } public Button? PreviousButton { get; set; } public Button? NextButton { get; set; } public StackPanel? PagesView { get; set; } /// protected override void OnApplyTemplate(TemplateAppliedEventArgs e) { if (PreviousButton != null) PreviousButton.Click -= PreviousButtonOnClick; if (NextButton != null) NextButton.Click -= NextButtonOnClick; PreviousButton = e.NameScope.Find