protected override void Dispose(DisposeTypes type) { if (disposed) { return; } if (type == DisposeTypes.Explicit) { // call the clear! if (RecycleCache != null) { foreach (RecyclerViewItem item in RecycleCache) { UnrealizeItem(item, false); } RecycleCache.Clear(); } InternalItemsLayouter.Clear(); InternalItemsLayouter = null; ItemsSource = null; ItemTemplate = null; if (InternalItemSource != null) { InternalItemSource.Dispose(); InternalItemSource = null; } // } base.Dispose(type); }
protected override void Dispose(DisposeTypes type) { if (disposed) { return; } if (type == DisposeTypes.Explicit) { disposed = true; // call the clear! if (RecycleCache != null) { foreach (RecyclerViewItem item in RecycleCache) { //ContentContainer.Remove(item); Utility.Dispose(item); } RecycleCache.Clear(); } InternalItemsLayouter.Clear(); InternalItemsLayouter = null; ItemsSource = null; ItemTemplate = null; if (InternalItemSource != null) { InternalItemSource.Dispose(); } // } base.Dispose(type); }
protected virtual void ClearCache() { foreach (RecyclerViewItem item in RecycleCache) { Utility.Dispose(item); } RecycleCache.Clear(); }
protected virtual RecyclerViewItem PopRecycleCache(DataTemplate Template) { for (int i = 0; i < RecycleCache.Count; i++) { RecyclerViewItem item = RecycleCache[i]; if (item.Template == Template) { RecycleCache.Remove(item); item.Show(); return(item); } } return(null); }
protected virtual bool PushRecycleCache(RecyclerViewItem item) { if (item == null) { throw new ArgumentNullException(nameof(item)); } if (RecycleCache.Count >= CacheMax) { return(false); } if (item.Template == null) { return(false); } item.Hide(); item.Index = -1; RecycleCache.Add(item); return(true); }