Ejemplo n.º 1
0
        private void OnItemsSourceChanged(object sender, EventArgs args)
        {
            if (this.recordCollection != null)
            {
                this.Unsubscribe();
            }

            this.recordCollection = this.AssociatedObject.ItemsSource as RecordCollection;

            if (this.recordCollection != null)
            {
                this.Subscribe();
            }
        }
Ejemplo n.º 2
0
        protected override void OnAttached()
        {
            base.OnAttached();

            this.recordCollection = this.AssociatedObject.ItemsSource as RecordCollection;

            var descriptor = DependencyPropertyDescriptor.FromProperty(
                ItemsControl.ItemsSourceProperty,
                typeof(Control));

            descriptor.AddValueChanged(this.AssociatedObject, this.OnItemsSourceChanged);

            if (this.recordCollection != null)
            {
                this.Subscribe();
            }
        }