private static void OnScalesPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { CircularGauge gauge = d as CircularGauge; if (gauge == null) { return; } GaugeScaleCollection oldScaleCollection = e.OldValue as GaugeScaleCollection; if (oldScaleCollection != null) { if (gauge._rootGrid != null) { } oldScaleCollection.CollectionChanged -= gauge.ScaleCollection_CollectionChanged; } GaugeScaleCollection newScaleCollection = e.NewValue as GaugeScaleCollection; if (newScaleCollection != null) { newScaleCollection.CollectionChanged += gauge.ScaleCollection_CollectionChanged; } }
private static void OnPointersPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { CircularGauge gauge = d as CircularGauge; if (gauge == null) { return; } GaugePointerCollection oldPointerCollection = e.OldValue as GaugePointerCollection; if (oldPointerCollection != null) { oldPointerCollection.CollectionChanged -= gauge.PointerCollection_CollectionChanged; } GaugePointerCollection newPointerCollection = e.NewValue as GaugePointerCollection; if (newPointerCollection != null) { newPointerCollection.CollectionChanged += gauge.PointerCollection_CollectionChanged; gauge.InitPointers(); } }