コード例 #1
0
        private static void OnLabelPathChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            LabelExtractor v = sender as LabelExtractor;

            if (v != null && v.LabelPath != null && v.Items != null)
            {
                v.GenerateLabelList();
            }
        }
コード例 #2
0
        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();
                }
            }
        }