瀏覽代碼

Remove unused/bad code.

Removed the code that was causing the TreeView problems described in #2944.  This code was never actually called except in `TreeView` because a plain `ItemsControl` can't be used with virtualization (it uses untyped `ItemContainerGenerator` so items can't be recycled) and every other derived class derives from SelectingItemsControl which overrides this method and doesn't call the base implementation. In addition there were no unit tests covering this code.

Fixes #2944
Steven Kirk 6 年之前
父節點
當前提交
cce605af49
共有 1 個文件被更改,包括 0 次插入13 次删除
  1. 0 13
      src/Avalonia.Controls/ItemsControl.cs

+ 0 - 13
src/Avalonia.Controls/ItemsControl.cs

@@ -302,19 +302,6 @@ namespace Avalonia.Controls
         /// <param name="e">The details of the containers.</param>
         protected virtual void OnContainersRecycled(ItemContainerEventArgs e)
         {
-            var toRemove = new List<ILogical>();
-
-            foreach (var container in e.Containers)
-            {
-                // If the item is its own container, then it will be removed from the logical tree
-                // when it is removed from the Items collection.
-                if (container?.ContainerControl != container?.Item)
-                {
-                    toRemove.Add(container.ContainerControl);
-                }
-            }
-
-            LogicalChildren.RemoveAll(toRemove);
         }
 
         /// <summary>