コード例 #1
0
        protected override NotifyingObservableCollection <TestDataObject> CreateCollection(List <TestDataObject> items)
        {
            parent = new TestDataObjectImpl();
            var result = new NotifyingObservableCollection <TestDataObject>(parent, "ParentProperty");

            foreach (var i in items)
            {
                result.Add(i);
            }

            _hasCollectionChanged     = false;
            result.CollectionChanged += (sender, args) => { _hasCollectionChanged = true; };

            _hasParentChanged       = false;
            parent.PropertyChanged += (sender, args) => { if (args.PropertyName == "ParentProperty")
                                                          {
                                                              _hasParentChanged = true;
                                                          }
            };

            if (_withBeginUpdate)
            {
                result.BeginUpdate();
                _expectChanges = false;
            }

            return(result);
        }