private static void OnLabelPathChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args) { LabelExtractor v = sender as LabelExtractor; if (v != null && v.LabelPath != null && v.Items != null) { v.GenerateLabelList(); } }
private static void OnItemsChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args) { LabelExtractor v = sender as LabelExtractor; ItemCollection oldItems = args.OldValue as ItemCollection; ItemCollection newItems = args.NewValue as ItemCollection; if (oldItems != null) { ((INotifyCollectionChanged)oldItems).CollectionChanged -= new NotifyCollectionChangedEventHandler(v.OnLabelsCollectionChanged); } if (v != null && v.Items != null) { ((INotifyCollectionChanged)v.Items).CollectionChanged += new NotifyCollectionChangedEventHandler(v.OnLabelsCollectionChanged); if (v.LabelPath != null) { v.GenerateLabelList(); } } }