Пример #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);
        }
        public BindableSegment()
        {
            for (int i = 0; i < 16; i++)
            {
                BindableColorButton button = new BindableColorButton()
                {
                    ButtonIndex = i
                };
                button.PropertyChanged += new PropertyChangedEventHandler(button_PropertyChanged);
                buttons.Add(button);
            }

            buttons.CollectionItemChanged += Buttons_CollectionItemChanged;
            UpdateTextLines();
        }