From df00cb29b4f689000351f1d4830b1579119c58ac Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Fri, 29 May 2020 21:08:22 +0200 Subject: [PATCH] Add ItemsRepeaterPage scroll to item buttons. To diagnose problems with `ItemsRepeater`. --- .../Pages/ItemsRepeaterPage.xaml | 5 ++- .../Pages/ItemsRepeaterPage.xaml.cs | 33 +++++++++++++++++-- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/samples/ControlCatalog/Pages/ItemsRepeaterPage.xaml b/samples/ControlCatalog/Pages/ItemsRepeaterPage.xaml index 028a294492..30f5b50f0c 100644 --- a/samples/ControlCatalog/Pages/ItemsRepeaterPage.xaml +++ b/samples/ControlCatalog/Pages/ItemsRepeaterPage.xaml @@ -16,12 +16,15 @@ + + - + diff --git a/samples/ControlCatalog/Pages/ItemsRepeaterPage.xaml.cs b/samples/ControlCatalog/Pages/ItemsRepeaterPage.xaml.cs index 6fa9fc515e..fdd9076d74 100644 --- a/samples/ControlCatalog/Pages/ItemsRepeaterPage.xaml.cs +++ b/samples/ControlCatalog/Pages/ItemsRepeaterPage.xaml.cs @@ -5,23 +5,32 @@ using Avalonia.Controls.Primitives; using Avalonia.Input; using Avalonia.Layout; using Avalonia.Markup.Xaml; +using Avalonia.VisualTree; using ControlCatalog.ViewModels; namespace ControlCatalog.Pages { public class ItemsRepeaterPage : UserControl { + private readonly ItemsRepeaterPageViewModel _viewModel; private ItemsRepeater _repeater; private ScrollViewer _scroller; + private Button _scrollToLast; + private Button _scrollToRandom; + private Random _random = new Random(0); public ItemsRepeaterPage() { this.InitializeComponent(); _repeater = this.FindControl("repeater"); _scroller = this.FindControl("scroller"); + _scrollToLast = this.FindControl