private void NotifyPropertyChanged(string propertyName)
 {
     if (PropertyChanged != null)
     {
         PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
     }
     if (propertyName == "Rooms")
     {
         CollectionChangedEvent.Invoke(null, null);
     }
 }
Exemple #2
0
            /// <summary>
            /// Called when the value of the <see cref="SourceProperty"/> changes.
            /// </summary>
            /// <param name="oldValue">The old value of the property.</param>
            /// <param name="newValue">The new value of the property.</param>
            internal void OnSourceChanged(IEnumerable oldValue, IEnumerable newValue)
            {
                if (oldValue != newValue)
                {
                    if (oldValue is INotifyCollectionChanged collection1)
                    {
                        CollectionChangedEvent.RemoveListener(collection1, this);
                    }

                    OnItemsReset(newValue);

                    if (newValue is INotifyCollectionChanged collection2)
                    {
                        CollectionChangedEvent.AddListener(collection2, this);
                    }
                }
            }
Exemple #3
0
            /// <summary>
            /// Initializes a new instance of the <see cref="ContainerCollection"/> class.
            /// </summary>
            /// <param name="items">The input data objects.</param>
            /// <param name="converter">The underlying converter.</param>
            internal ContainerCollection(IList items, ItemsConverter converter) : this(new ObservableCollection <DependencyObject>(converter.GetContainers(items)))
            {
                this.converter = converter;

                propertyListener = new PropertyChangedListener(this);

                PropertyChangedEvent.AddListener(converter, propertyListener);

                if (items is INotifyCollectionChanged collection)
                {
                    this.items = items;

                    collectionListener = new CollectionChangedListener(this);

                    CollectionChangedEvent.AddListener(collection, collectionListener);
                }
            }
Exemple #4
0
            /// <summary>
            /// Initializes a new instance of the <see cref="GroupingCollection"/> class.
            /// </summary>
            /// <param name="enumerable">The input sequence.</param>
            /// <param name="grouping">The underlying grouping.</param>
            internal GroupingCollection(IEnumerable <DependencyObject> enumerable, Grouping grouping) : this(new RecomposableCollection <DependencyObject>(grouping.GroupSort(enumerable)))
            {
                this.grouping = grouping;

                propertyListener = new PropertyChangedListener(this);

                PropertyChangedEvent.AddListener(grouping, propertyListener);

                if (enumerable is INotifyCollectionChanged collection)
                {
                    this.enumerable = enumerable;

                    collectionListener = new CollectionChangedListener(this);

                    CollectionChangedEvent.AddListener(collection, collectionListener);
                }
            }
Exemple #5
0
 private void OnCollectionChanged()
 {
     CollectionChangedEvent?.Invoke(_dictionary.Values.ToArray());
 }