public Driver(FastVerticallyScrollingItemViewer parent, IComparer <T> comparer) { this._parent = parent; this._layoutTree = new PersistentAggregatingRedBlackTree <Unique <T>, ControlData, double>( (a1, k, v, a2) => a1 + v.Value.Type.Height + a2, Unique <T> .MakeComparerUnique(comparer)); parent.scrollView.ViewChanged += (sender, arg) => UpdateShown(); parent.scrollView.SizeChanged += (sender, arg) => { parent.layoutArea.Width = arg.NewSize.Width; // Warning: removing this may result in search results that drift right/left as they are manipulated by touch UpdateShown(); }; }
public Unique <T> Add(T key, IVirtualControlValue value) { if (value == null) { throw new ArgumentNullException("value"); } var uniqueKey = new Unique <T>(key); _layoutTree = _layoutTree.With(uniqueKey, new ControlData { Value = value, Key = key }, overwrite: false); ScheduleUpdateShown(); return(uniqueKey); }
public void Clear() { _layoutTree = _layoutTree.WithEmpty(); ScheduleUpdateShown(); }
public void Remove(Unique <T> key) { _layoutTree = _layoutTree.WithoutKey(key); ScheduleUpdateShown(); }