浏览代码

Ensure to update scroll info when items changed.

Steven Kirk 9 年之前
父节点
当前提交
cce2ab603f
共有 1 个文件被更改,包括 9 次插入0 次删除
  1. 9 0
      src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs

+ 9 - 0
src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs

@@ -2,7 +2,10 @@
 // Licensed under the MIT license. See licence.md file in the project root for full license information.
 
 using System;
+using System.Collections;
+using System.Collections.Specialized;
 using System.Linq;
+using Avalonia.Controls.Primitives;
 using Avalonia.Controls.Utils;
 
 namespace Avalonia.Controls.Presenters
@@ -122,6 +125,12 @@ namespace Avalonia.Controls.Presenters
             CreateRemoveContainers();
         }
 
+        public override void ItemsChanged(IEnumerable items, NotifyCollectionChangedEventArgs e)
+        {
+            base.ItemsChanged(items, e);
+            ((IScrollable)Owner).InvalidateScroll();
+        }
+
         private void CreateRemoveContainers()
         {
             var generator = Owner.ItemContainerGenerator;