Пример #1
0
 private static void DetachOldDataSourceCollectionChangedListener(SerialChart chart, object dataSource)
 {
     if (dataSource != null && dataSource is INotifyCollectionChanged)
     {
         (dataSource as INotifyCollectionChanged).CollectionChanged -= chart.OnDataSourceCollectionChanged;
     }
 }
Пример #2
0
 private static void AttachDataSourceCollectionChangedListener(SerialChart chart, object dataSource)
 {
     if (dataSource != null && dataSource is INotifyCollectionChanged)
     {
         (dataSource as INotifyCollectionChanged).CollectionChanged += new NotifyCollectionChangedEventHandler(chart.OnDataSourceCollectionChanged);
     }
 }
Пример #3
0
        private static void OnDataSourcePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            SerialChart chart = d as SerialChart;

            DetachOldDataSourceCollectionChangedListener(chart, e.OldValue);
            AttachDataSourceCollectionChangedListener(chart, e.NewValue);
            chart.ProcessData();
        }