コード例 #1
0
    public ObservableConcurrentDictionaryView(ObservableConcurrentDictionary <TKey, TValue> dictionary, Func <TValue, TView> selector, string propertyName)
    {
        _propertyName = propertyName;
        _selector     = selector;

        _view = new ObservableConcurrentDictionary <TKey, TView>();
        _view.PropertyChanged   += (s, e) => PropertyChanged?.Invoke(s, e);
        _view.CollectionChanged += (s, e) => CollectionChanged?.Invoke(s, e);

        _dictionary = dictionary;
        _dictionary.CollectionChanged += OnSourceCollectionChanged;
        _dictionary.PropertyChanged   += OnSourceItemPropertyChanged;

        OnSourceCollectionChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, _dictionary.ToList()));
    }