private static void OnValuePathChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args) { ValueExtractor v = sender as ValueExtractor; if (v != null && v.ValuePath != null && v.Items != null) { v.GenerateValueList(); } }
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(); } } }