示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
 public SyncedObservableCollection_Simple(MyObservableCollection <T> source, ObservableCollection <T> synced, IEqualityComparer <T> equalityComparer)
 {
     this.Synced           = synced;
     this.Source           = source;
     this.EqualityComparer = equalityComparer;
 }
示例#4
0
 public SyncedObservableCollection_Simple(MyObservableCollection <T> source, IEqualityComparer <T> equalityComparer)
     : this(source, new ObservableCollection <T>(), equalityComparer)
 {
 }
示例#5
0
 public SyncedObservableCollection_Simple(MyObservableCollection <T> source) : this(source, null)
 {
 }
示例#6
0
 public SyncedObservableCollection(MyObservableCollection <T> source, ObservableCollection <T> synced)
 {
 }
示例#7
0
 public SyncedObservableCollection(MyObservableCollection <T> source) : this(source, new ObservableCollection <T>())
 {
 }
示例#8
0
 public SyncedObservableCollection_View(MyObservableCollection <T> source, IEqualityComparer <T> equalityComparer)
     : base(source, equalityComparer)
 {
 }