예제 #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();
            }
        }
예제 #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 -= v.OnItemsCollectionChanged;
            }

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