mirror of
https://gitcode.com/gh_mirrors/se/Semi.Avalonia
synced 2026-04-08 10:16:35 +08:00
* feat: add CarouselPage and PipsPager. * feat: add PipsPager control and integrate into index * feat: add PipsPagerDemo and integrate into MainView --------- Co-authored-by: Zhang Dian <54255897+zdpcdt@users.noreply.github.com>
34 lines
946 B
C#
34 lines
946 B
C#
using System.Collections;
|
|
using Avalonia.Controls;
|
|
using Avalonia.Interactivity;
|
|
|
|
namespace Semi.Avalonia.Demo.Pages;
|
|
|
|
public partial class CarouselPageDemo : UserControl
|
|
{
|
|
public CarouselPageDemo()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void OnPrevious(object? sender, RoutedEventArgs e)
|
|
{
|
|
if (DemoCarousel.SelectedIndex > 0)
|
|
DemoCarousel.SelectedIndex--;
|
|
}
|
|
|
|
private void OnNext(object? sender, RoutedEventArgs e)
|
|
{
|
|
var pageCount = (DemoCarousel.Pages as IList)?.Count ?? 0;
|
|
if (DemoCarousel.SelectedIndex < pageCount - 1)
|
|
DemoCarousel.SelectedIndex++;
|
|
}
|
|
|
|
private void OnSelectionChanged(object? sender, PageSelectionChangedEventArgs e)
|
|
{
|
|
if (StatusText == null)
|
|
return;
|
|
var pageCount = (DemoCarousel.Pages as IList)?.Count ?? 0;
|
|
StatusText.Text = $"Page {DemoCarousel.SelectedIndex + 1} of {pageCount}";
|
|
}
|
|
} |