1
0
Эх сурвалжийг харах

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 жил өмнө
parent
commit
cce605af49

+ 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>