/// <summary> /// Called when [series source changed]. /// </summary> /// <param name="d">The d.</param> /// <param name="e">The <see cref="System.Windows.DependencyPropertyChangedEventArgs"/> instance containing the event data.</param> private static void OnSeriesSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { IEnumerable oldValue = (IEnumerable)e.OldValue; IEnumerable newValue = (IEnumerable)e.NewValue; DataChartEx source = (DataChartEx)d; //TODO: Change over to using a Weak Event pattern INotifyCollectionChanged ncc; if (oldValue != null) { ncc = oldValue as INotifyCollectionChanged; if (ncc != null) { ncc.CollectionChanged -= source.Series_CollectionChanged; } } if (newValue != null) { ncc = newValue as INotifyCollectionChanged; if (ncc != null) { ncc.CollectionChanged += source.Series_CollectionChanged; } } source.OnSeriesSourceChanged(oldValue, newValue); }
/// <summary> /// Called when [selected chart type changed]. /// </summary> /// <param name="d">The d.</param> /// <param name="e">The <see cref="System.Windows.DependencyPropertyChangedEventArgs"/> instance containing the event data.</param> private static void OnSelectedChartTypeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { DataChartEx source = (DataChartEx)d; source.OnSeriesSourceChanged(null, source.SeriesSource); }