Beispiel #1
0
        public DataPoint GetDataPointFromMouseEvent(MouseButtonEventArgs e)
        {
            Polyline polyline1 = e.OriginalSource as Polyline;

            if (polyline1 != null)
            {
                PolylineControl polyline2 = polyline1.Parent as PolylineControl;
                if (polyline2 != null && polyline2.Parent is UIElement)
                {
                    return((DataPoint)LineSeriesPresenter.FindDataPoint(polyline2, e.GetPosition((IInputElement)(polyline2.Parent as UIElement))));
                }
            }
            return(this.GetDataPointFromVisualElement(e.OriginalSource as DependencyObject));
        }
Beispiel #2
0
        internal static XYDataPoint FindDataPoint(PolylineControl polyline, Point position)
        {
            XYDataPoint xyDataPoint1 = (XYDataPoint)null;

            foreach (IAppearanceProvider appearanceProvider in polyline.Appearances)
            {
                XYDataPoint xyDataPoint2 = appearanceProvider as XYDataPoint;
                if (xyDataPoint2 != null && xyDataPoint2.View != null && !xyDataPoint2.ActualIsEmpty)
                {
                    if (xyDataPoint1 == null)
                    {
                        xyDataPoint1 = xyDataPoint2;
                    }
                    else if (LineSeriesPresenter.GetDistance(position, xyDataPoint2.View.AnchorPoint) < LineSeriesPresenter.GetDistance(position, xyDataPoint1.View.AnchorPoint))
                    {
                        xyDataPoint1 = xyDataPoint2;
                    }
                }
            }
            return(xyDataPoint1);
        }
Beispiel #3
0
 private void Tooltip_Opened(object sender, RoutedEventArgs e)
 {
     this._tooltip.Content = (object)LineSeriesPresenter.FindDataPoint(this.PolylineControl, this._mousePosition).ToolTipContent;
 }