Browse Source

fix: `ItemsControlFromItemContainer` typo (#13118)

- Renamed `ItemsControlFromItemContaner` in `ItemsControlFromItemContainer'
- Add `ItemsControlFromItemContaner`  with attributes `Obsolete` and `EditorBrowsable Never` that call `ItemsControlFromItemContainer`
release/11.0.7
workgroupengineering 2 years ago
committed by Max Katz
parent
commit
c38766daad
  1. 15
      src/Avalonia.Controls/ItemsControl.cs
  2. 4
      src/Avalonia.Controls/ListBoxItem.cs

15
src/Avalonia.Controls/ItemsControl.cs

@ -305,7 +305,20 @@ namespace Avalonia.Controls
/// <returns>
/// The owning <see cref="ItemsControl"/> or null if the control is not an items container.
/// </returns>
public static ItemsControl? ItemsControlFromItemContaner(Control container)
[Obsolete("Typo, use ItemsControlFromItemContainer instead")]
[EditorBrowsable(EditorBrowsableState.Never)]
[Browsable(false)]
public static ItemsControl? ItemsControlFromItemContaner(Control container) =>
ItemsControlFromItemContainer(container);
/// <summary>
/// Returns the <see cref="ItemsControl"/> that owns the specified container control.
/// </summary>
/// <param name="container">The container.</param>
/// <returns>
/// The owning <see cref="ItemsControl"/> or null if the control is not an items container.
/// </returns>
public static ItemsControl? ItemsControlFromItemContainer(Control container)
{
var c = container.Parent as Control;

4
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))
{

Loading…
Cancel
Save