コード例 #1
0
        /// <summary>
        /// Creates a new <see cref="Subscriber"/> for the specified source object.
        /// </summary>
        /// <typeparam name="T">The type of the source object.</typeparam>
        /// <param name="source">The source object.</param>
        /// <returns>A <see cref="Subscriber"/> for the <paramref name="source"/>.</returns>
        private Subscriber CreateObserve <T>(T source) where T : class, INotifyPropertyChanged
        {
            Subscriber subscriber = Subscriber.Create(source, this);

            PropertyChangedEvent.AddListener(source, subscriber);

            return(subscriber);
        }
コード例 #2
0
ファイル: ItemsConverter.cs プロジェクト: qube7/qcomposite
            /// <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);
                }
            }
コード例 #3
0
ファイル: Grouping.cs プロジェクト: qube7/qcomposite
            /// <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);
                }
            }