/// <summary> /// Adjusts the event handlers. /// </summary> /// <param name="sender">The sender.</param> /// <param name="oldValue">The old value.</param> /// <param name="newValue">The new value.</param> protected void AdjustEventHandlers(DependencyObject sender, object oldValue, object newValue) { ChartSeries element = sender as ChartSeries; if (element == null) { return; } if (newValue != null) { element.AddHandler(routedEvent, new RoutedEventHandler(EventHandler)); if (routedEvent == Mouse.MouseMoveEvent) { element.MouseMove += new ChartMouseEventHandler(element_MouseMove); } else if (routedEvent == Mouse.MouseLeaveEvent) { element.MouseLeave += new ChartMouseEventHandler(element_MouseLeave); } } }