protected override View GetViewFor(int section, int index) { var item = (T)GetItemAt(section, index); if (item == null) { return(null); } if (!CurrentViews.TryGetValue(item, out var view) || (view?.IsDisposed ?? true)) { using (new StateBuilder(State)) { if (item is INotifyPropertyRead read) { State.StartMonitoring(read); } view = ViewFor?.Invoke(item); } if (view == null) { return(null); } CurrentViews[item] = view; view.Parent = this; } return(view); }
protected override View ViewFor(int index) { var item = List[index]; if (!CurrentViews.TryGetValue(item, out var view) || (view?.IsDisposed ?? true)) { CurrentViews[item] = view = Cell(item); view.Parent = this; } return(view); }
protected override void Dispose(bool disposing) { if (!disposing) { return; } DisposeObservable(); var currentViews = CurrentViews.ToList(); CurrentViews.Clear(); currentViews.ForEach(x => x.Value?.Dispose()); base.Dispose(disposing); }
protected override View GetViewFor(int section, int index) { var item = (T)GetItemAt(section, index); if (item == null) { return(null); } var key = (section, item); if (!CurrentViews.TryGetValue(key, out var view) || (view?.IsDisposed ?? true)) { view = sections.SafeGetAtIndex(section, GetCachedSection)?.GetViewFor(index)?.SetParent(this); if (view == null) { return(null); } CurrentViews[key] = view; } return(view); }