private static void AttachDataSourceCollectionChangedListener(PieChart chart, object dataSource) { if (dataSource != null && dataSource is INotifyCollectionChanged) { (dataSource as INotifyCollectionChanged).CollectionChanged += new NotifyCollectionChangedEventHandler(chart.OnDataSourceCollectionChanged); } }
private static void DetachOldDataSourceCollectionChangedListener(PieChart chart, object dataSource) { if (dataSource != null && dataSource is INotifyCollectionChanged) { (dataSource as INotifyCollectionChanged).CollectionChanged -= chart.OnDataSourceCollectionChanged; } }