Просмотр исходного кода

Ensure to update scroll info when items changed.

Steven Kirk 9 лет назад
Родитель
Сommit
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.
 // Licensed under the MIT license. See licence.md file in the project root for full license information.
 
 
 using System;
 using System;
+using System.Collections;
+using System.Collections.Specialized;
 using System.Linq;
 using System.Linq;
+using Avalonia.Controls.Primitives;
 using Avalonia.Controls.Utils;
 using Avalonia.Controls.Utils;
 
 
 namespace Avalonia.Controls.Presenters
 namespace Avalonia.Controls.Presenters
@@ -122,6 +125,12 @@ namespace Avalonia.Controls.Presenters
             CreateRemoveContainers();
             CreateRemoveContainers();
         }
         }
 
 
+        public override void ItemsChanged(IEnumerable items, NotifyCollectionChangedEventArgs e)
+        {
+            base.ItemsChanged(items, e);
+            ((IScrollable)Owner).InvalidateScroll();
+        }
+
         private void CreateRemoveContainers()
         private void CreateRemoveContainers()
         {
         {
             var generator = Owner.ItemContainerGenerator;
             var generator = Owner.ItemContainerGenerator;