Browse Source

Merge pull request #4436 from AvaloniaUI/fixes/4409-remove-itemssourceview-cachedsize

Stop ItemsSourceView using a cached size.
Nikita Tsukanov 5 years ago
parent
commit
c4e9373a54
1 changed files with 1 additions and 14 deletions
  1. 1 14
      src/Avalonia.Controls/Repeater/ItemsSourceView.cs

+ 1 - 14
src/Avalonia.Controls/Repeater/ItemsSourceView.cs

@@ -25,7 +25,6 @@ namespace Avalonia.Controls
     {
         private readonly IList _inner;
         private INotifyCollectionChanged _notifyCollectionChanged;
-        private int _cachedSize = -1;
 
         /// <summary>
         /// Initializes a new instance of the ItemsSourceView class for the specified data source.
@@ -54,18 +53,7 @@ namespace Avalonia.Controls
         /// <summary>
         /// Gets the number of items in the collection.
         /// </summary>
-        public int Count
-        {
-            get
-            {
-                if (_cachedSize == -1)
-                {
-                    _cachedSize = _inner.Count;
-                }
-
-                return _cachedSize;
-            }
-        }
+        public int Count => _inner.Count;
 
         /// <summary>
         /// Gets a value that indicates whether the items source can provide a unique key for each item.
@@ -126,7 +114,6 @@ namespace Avalonia.Controls
 
         protected void OnItemsSourceChanged(NotifyCollectionChangedEventArgs args)
         {
-            _cachedSize = _inner.Count;
             CollectionChanged?.Invoke(this, args);
         }