Browse Source

fix: `ItemsControlFromItemContainer` typo (#13118)

- Renamed `ItemsControlFromItemContaner` in `ItemsControlFromItemContainer'
- Add `ItemsControlFromItemContaner`  with attributes `Obsolete` and `EditorBrowsable Never` that call `ItemsControlFromItemContainer`
pull/13128/head
workgroupengineering 3 years ago
committed by GitHub
parent
commit
d2cbf97b3e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  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> /// <returns>
/// The owning <see cref="ItemsControl"/> or null if the control is not an items container. /// The owning <see cref="ItemsControl"/> or null if the control is not an items container.
/// </returns> /// </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; var c = container.Parent as Control;

4
src/Avalonia.Controls/ListBoxItem.cs

@ -55,7 +55,7 @@ namespace Avalonia.Controls
if (e.Handled) if (e.Handled)
return; return;
if (!e.Handled && ItemsControl.ItemsControlFromItemContaner(this) is ListBox owner) if (!e.Handled && ItemsControl.ItemsControlFromItemContainer(this) is ListBox owner)
{ {
var p = e.GetCurrentPoint(this); var p = e.GetCurrentPoint(this);
@ -97,7 +97,7 @@ namespace Avalonia.Controls
if (new Rect(Bounds.Size).ContainsExclusive(point.Position) && if (new Rect(Bounds.Size).ContainsExclusive(point.Position) &&
tapRect.ContainsExclusive(point.Position) && tapRect.ContainsExclusive(point.Position) &&
ItemsControl.ItemsControlFromItemContaner(this) is ListBox owner) ItemsControl.ItemsControlFromItemContainer(this) is ListBox owner)
{ {
if (owner.UpdateSelectionFromPointerEvent(this, e)) if (owner.UpdateSelectionFromPointerEvent(this, e))
{ {

Loading…
Cancel
Save