System.Windows.Data.DataList.AddItem C# (CSharp) Method

AddItem() private method

private AddItem ( object item, bool notifyPropertyChange ) : void
item object
notifyPropertyChange bool
return void
        private void AddItem(object item, bool notifyPropertyChange)
        {
            int index = _snapShot.Count;
            if (_comparer != null) {
                index = _snapShot.BinarySearch(item, _comparer);
                index = ~index;
            }

            bool currentIndexChanged = false;
            if (IsCurrencyEnabled && (index <= _currentIndex)) {
                currentIndexChanged = true;
            }

            _snapShot.Insert(index, item);

            if (currentIndexChanged) {
                CurrentIndex++;
            }

            if (notifyPropertyChange && (_propChangedHandler != null)) {
                RaisePropertyChanged("Count");

                if (currentIndexChanged) {
                    RaisePropertyChanged("CanMovePrevious");
                    RaisePropertyChanged("CanMoveNext");
                }
            }

            RaiseCollectionChanged(NotifyCollectionChangedAction.Add, item, index);
        }