From 3d5014400cfa9be02f32197c26eb9c5a51419893 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Fri, 9 Feb 2024 23:20:24 +0100 Subject: [PATCH] Move ScrollInfoView into ItemsControl. (#14538) Fixes #14524 --- src/Avalonia.Controls/ItemsControl.cs | 12 ++++++++++++ .../Primitives/SelectingItemsControl.cs | 12 ------------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Avalonia.Controls/ItemsControl.cs b/src/Avalonia.Controls/ItemsControl.cs index 366c145356..f7fbf8112d 100644 --- a/src/Avalonia.Controls/ItemsControl.cs +++ b/src/Avalonia.Controls/ItemsControl.cs @@ -298,6 +298,18 @@ namespace Avalonia.Controls /// public IEnumerable GetRealizedContainers() => Presenter?.GetRealizedContainers() ?? Array.Empty(); + /// + /// Scrolls the specified item into view. + /// + /// The index of the item. + public void ScrollIntoView(int index) => Presenter?.ScrollIntoView(index); + + /// + /// Scrolls the specified item into view. + /// + /// The item. + public void ScrollIntoView(object item) => ScrollIntoView(ItemsView.IndexOf(item)); + /// /// Returns the that owns the specified container control. /// diff --git a/src/Avalonia.Controls/Primitives/SelectingItemsControl.cs b/src/Avalonia.Controls/Primitives/SelectingItemsControl.cs index 6c58044c79..185af1a715 100644 --- a/src/Avalonia.Controls/Primitives/SelectingItemsControl.cs +++ b/src/Avalonia.Controls/Primitives/SelectingItemsControl.cs @@ -409,18 +409,6 @@ namespace Avalonia.Controls.Primitives EndUpdating(); } - /// - /// Scrolls the specified item into view. - /// - /// The index of the item. - public void ScrollIntoView(int index) => Presenter?.ScrollIntoView(index); - - /// - /// Scrolls the specified item into view. - /// - /// The item. - public void ScrollIntoView(object item) => ScrollIntoView(ItemsView.IndexOf(item)); - /// /// Gets the value of the on the specified control. ///