protected virtual void OnSourceChanged(MyObservableCollection <T> oldSource) { if (oldSource != null) { oldSource.ItemAttached -= Source_ItemAttached; oldSource.ItemDetached -= Source_ItemDetached; } this.Synced.Clear(); this.Source.ItemAttached += Source_ItemAttached; this.Source.ItemDetached += Source_ItemDetached; this.Source.ForEach(item => this.Synced.Add(item)); SourceChanged?.Invoke(this, oldSource); }
protected virtual void OnSourceChanged(MyObservableCollection <T> oldSource) { oldSource.ItemAttached -= Source_ItemAttached; oldSource.ItemDetached -= Source_ItemDetached; oldSource.ItemMoved -= Source_ItemMoved; this.Synced.Clear(); var internalFilter = this.InternalFilter; this.sourceFilterResults = this.Source.Select(item => internalFilter(item)).ToList(); this.Source.ItemAttached += Source_ItemAttached; this.Source.ItemDetached += Source_ItemDetached; this.Source.ItemMoved += Source_ItemMoved; this.Source.Where(item => InternalFilter(item)) .ForEach(item => this.Synced.Add(item)); SourceChanged?.Invoke(this, oldSource); }
public SyncedObservableCollection_Simple(MyObservableCollection <T> source, ObservableCollection <T> synced, IEqualityComparer <T> equalityComparer) { this.Synced = synced; this.Source = source; this.EqualityComparer = equalityComparer; }
public SyncedObservableCollection_Simple(MyObservableCollection <T> source, IEqualityComparer <T> equalityComparer) : this(source, new ObservableCollection <T>(), equalityComparer) { }
public SyncedObservableCollection_Simple(MyObservableCollection <T> source) : this(source, null) { }
public SyncedObservableCollection(MyObservableCollection <T> source, ObservableCollection <T> synced) { }
public SyncedObservableCollection(MyObservableCollection <T> source) : this(source, new ObservableCollection <T>()) { }
public SyncedObservableCollection_View(MyObservableCollection <T> source, IEqualityComparer <T> equalityComparer) : base(source, equalityComparer) { }