From c38766daadf5f4e08021823cc94303c64d2d40b7 Mon Sep 17 00:00:00 2001 From: workgroupengineering Date: Wed, 4 Oct 2023 04:19:32 +0200 Subject: [PATCH] fix: `ItemsControlFromItemContainer` typo (#13118) - Renamed `ItemsControlFromItemContaner` in `ItemsControlFromItemContainer' - Add `ItemsControlFromItemContaner` with attributes `Obsolete` and `EditorBrowsable Never` that call `ItemsControlFromItemContainer` --- src/Avalonia.Controls/ItemsControl.cs | 15 ++++++++++++++- src/Avalonia.Controls/ListBoxItem.cs | 4 ++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/Avalonia.Controls/ItemsControl.cs b/src/Avalonia.Controls/ItemsControl.cs index 0e4a3036fb..366c145356 100644 --- a/src/Avalonia.Controls/ItemsControl.cs +++ b/src/Avalonia.Controls/ItemsControl.cs @@ -305,7 +305,20 @@ namespace Avalonia.Controls /// /// The owning or null if the control is not an items container. /// - public static ItemsControl? ItemsControlFromItemContaner(Control container) + [Obsolete("Typo, use ItemsControlFromItemContainer instead")] + [EditorBrowsable(EditorBrowsableState.Never)] + [Browsable(false)] + public static ItemsControl? ItemsControlFromItemContaner(Control container) => + ItemsControlFromItemContainer(container); + + /// + /// Returns the that owns the specified container control. + /// + /// The container. + /// + /// The owning or null if the control is not an items container. + /// + public static ItemsControl? ItemsControlFromItemContainer(Control container) { var c = container.Parent as Control; diff --git a/src/Avalonia.Controls/ListBoxItem.cs b/src/Avalonia.Controls/ListBoxItem.cs index ddf1f7091d..aa95511524 100644 --- a/src/Avalonia.Controls/ListBoxItem.cs +++ b/src/Avalonia.Controls/ListBoxItem.cs @@ -55,7 +55,7 @@ namespace Avalonia.Controls if (e.Handled) return; - if (!e.Handled && ItemsControl.ItemsControlFromItemContaner(this) is ListBox owner) + if (!e.Handled && ItemsControl.ItemsControlFromItemContainer(this) is ListBox owner) { var p = e.GetCurrentPoint(this); @@ -97,7 +97,7 @@ namespace Avalonia.Controls if (new Rect(Bounds.Size).ContainsExclusive(point.Position) && tapRect.ContainsExclusive(point.Position) && - ItemsControl.ItemsControlFromItemContaner(this) is ListBox owner) + ItemsControl.ItemsControlFromItemContainer(this) is ListBox owner) { if (owner.UpdateSelectionFromPointerEvent(this, e)) {