Example #1
0
        private static void OnValuePathChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            ValueExtractor v = sender as ValueExtractor;

            if (v != null && v.ValuePath != null && v.Items != null)
            {
                v.GenerateValueList();
            }
        }
Example #2
0
        private static void OnItemsChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            ValueExtractor v        = sender as ValueExtractor;
            ItemCollection oldItems = args.OldValue as ItemCollection;
            ItemCollection newItems = args.NewValue as ItemCollection;

            if (oldItems != null)
            {
                ((INotifyCollectionChanged)oldItems).CollectionChanged -= new NotifyCollectionChangedEventHandler(v.OnItemsCollectionChanged);
            }

            if (v != null && v.Items != null)
            {
                ((INotifyCollectionChanged)v.Items).CollectionChanged += new NotifyCollectionChangedEventHandler(v.OnItemsCollectionChanged);
                if (v.ValuePath != null)
                {
                    v.GenerateValueList();
                }
            }
        }