protected override Rect GetBoundingRectangleCore() { if (this.Series == null || this.Series.ChartArea == null || !this.Series.ChartArea.IsTemplateApplied) { return(base.GetBoundingRectangleCore()); } FrameworkElement dataPointView = SeriesVisualStatePresenter.GetDataPointView(this.DataPoint); if (dataPointView != null) { return(new FrameworkElementAutomationPeer(dataPointView).GetBoundingRectangle()); } AutomationPeer peerForElement = UIElementAutomationPeer.CreatePeerForElement((UIElement)this.Series); if (!(this.Series is LineSeries) || this.DataPoint.View == null || peerForElement == null) { return(base.GetBoundingRectangleCore()); } Point anchorPoint = this.DataPoint.View.AnchorPoint; Rect rectangle = RectExtensions.Expand(new Rect(anchorPoint.X, anchorPoint.Y, 0.0, 0.0), 2.0, 2.0); Rect boundingRectangle = peerForElement.GetBoundingRectangle(); Size renderSize = this.Series.SeriesPresenter.RootPanel.RenderSize; Size size = RectExtensions.GetSize(boundingRectangle); return(RectExtensions.Translate(RectExtensions.Transform(rectangle, (Transform) new ScaleTransform() { ScaleX = (size.Width / renderSize.Width), ScaleY = (size.Height / renderSize.Height) }), boundingRectangle.X, boundingRectangle.Y)); }
internal virtual void UpdateDataPointZIndex(DataPoint dataPoint) { FrameworkElement dataPointView = SeriesVisualStatePresenter.GetDataPointView(dataPoint); if (dataPointView == null) { return; } Panel.SetZIndex((UIElement)dataPointView, dataPoint.IsSelected ? Math.Max(dataPoint.ZIndex, 32766) : Math.Max(dataPoint.ZIndex, 0)); }
internal override void OnRemoveView(DataPoint dataPoint) { FrameworkElement element = SeriesVisualStatePresenter.GetDataPointView(dataPoint); if (!(element is Control) || DataPoint.GetDataPoint((DependencyObject)element) != dataPoint) { return; } element.MouseEnter -= (MouseEventHandler)((s, e) => VisualStateManager.GoToState((FrameworkElement)(element as Control), "MouseOver", true)); element.MouseLeave -= (MouseEventHandler)((s, e) => VisualStateManager.GoToState((FrameworkElement)(element as Control), "Normal", true)); }
internal override void OnUpdateView(DataPoint dataPoint) { FrameworkElement element = SeriesVisualStatePresenter.GetDataPointView(dataPoint); if (element != null && DataPoint.GetDataPoint((DependencyObject)element) != dataPoint) { DataPoint.SetDataPoint((DependencyObject)element, dataPoint); if (element is Control) { element.MouseEnter += (MouseEventHandler)((s, e) => VisualStateManager.GoToState((FrameworkElement)(element as Control), "MouseOver", true)); element.MouseLeave += (MouseEventHandler)((s, e) => VisualStateManager.GoToState((FrameworkElement)(element as Control), "Normal", true)); } } FrameworkElement frameworkElement = dataPoint.View == null || dataPoint.View.LabelView == null ? (FrameworkElement)null : (FrameworkElement)dataPoint.View.LabelView; if (frameworkElement == null || DataPoint.GetDataPoint((DependencyObject)frameworkElement) == dataPoint) { return; } DataPoint.SetDataPoint((DependencyObject)frameworkElement, dataPoint); }
internal override void UpdateDataPointZIndex(DataPoint dataPoint) { FrameworkElement dataPointView = SeriesVisualStatePresenter.GetDataPointView(dataPoint); if (dataPointView == null) { return; } int val1 = dataPoint.ZIndex; if (val1 == 0) { val1 = 16383 - (int)(dataPointView.Width * 50.0); } if (dataPoint.IsSelected) { val1 += 16383; } int num = Math.Max(Math.Min(val1, 32766), -32766); Panel.SetZIndex((UIElement)dataPointView, num); }
protected virtual void UpdateActualPropertiesFromDataPoint(string propertyName) { if (propertyName == null || propertyName == "MarkerType" || (propertyName == "MarkerSize" || propertyName == "LabelMargin")) { this.UpdateActualLabelMargin(); } if (propertyName == null || propertyName == "LabelContent" || (propertyName == "ShowValueAsLabel" || propertyName == "StringFormat")) { this.UpdateActualLabelContent(); } if (propertyName == null || propertyName == "IsEmpty") { this.UpdateActualDataPointStyle(); } if (propertyName == null || propertyName == "Effect" || (propertyName == "UnselectedEffect" || propertyName == "IsDimmed")) { this.UpdateActualDataPointEffect(); } if (propertyName == null || propertyName == "Opacity" || (propertyName == "UnselectedOpacity" || propertyName == "IsDimmed")) { this.UpdateActualDataPointOpacity(); } if (propertyName == null || propertyName == "ZIndex") { FrameworkElement dataPointView = SeriesVisualStatePresenter.GetDataPointView(this); if (dataPointView != null) { Panel.SetZIndex((UIElement)dataPointView, this.ZIndex); } } if (propertyName == null || propertyName == "IsSelected") { if (this.Series != null && this.Series.SeriesPresenter != null) { this.Series.SeriesPresenter.UpdateDataPointZIndex(this); } if (this.Series != null) { this.Series.UpdateSelectedDataPointFlag(this); this.UpdateActualDataPointOpacity(); this.UpdateActualDataPointEffect(); } } if (propertyName != null && !(propertyName == "ViewState")) { return; } if (this.ViewState == DataPointViewState.Hidden) { if (this.Series == null || this.Series.DataPoints.Contains(this)) { return; } this.IsSelected = false; } else { if (this.ViewState != DataPointViewState.Showing || !this.IsNewlyAdded || (!this.IsSelected || this.Series == null)) { return; } this.Series.UpdateSelectedDataPointFlag(this); } }
public DataPoint GetDataPointFromVisualElement(DependencyObject element) { return(SeriesVisualStatePresenter.GetDataPointFromSelectedElement(element, (DependencyObject)this)); }