示例#1
0
        private void ChartControl_PointPressed(object sender, PointerRoutedEventArgs e)
        {
            e.Handled = true;

            if (_mainCollection == null)
            {
                return;
            }

            var ppointer = e.GetCurrentPoint(this);

            _gestureRecognizer.ProcessDownEvent(ppointer);

            if (startPoint != null)
            {
                DropPointerAction();
                return;
            }

            startPoint = ppointer.Position;

            if (!IsPointInChart(startPoint.Value))
            {
                return;
            }

            Focus();
            if (_drawingCustomGraphics != null)
            {
                if (!_isCustomGraphicsDrawingStarted)
                {
                    _drawingCustomGraphics.StartDraw(startPoint.Value);
                    _isCustomGraphicsDrawingStarted = true;
                }
            }
            else
            {
                pointerAction = PointerStartAction;
                midPoint      = null;

                if (pointerAction == PointerAction.Measure)
                {
                    midPoint = null;

                    if (MeasureGraphics != null)
                    {
                        MeasureGraphics.StartDraw(startPoint.Value);
                    }
                }
            }
        }
        private void ChartControl_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            e.Handled = true;

            if (_mainCollection == null)
            {
                return;
            }

            if (!IsFocused)
            {
                this.Focus();
            }

            startPoint = e.GetPosition(this);

            if (!IsPointInChart(startPoint.Value))
            {
                return;
            }

            if (_drawingCustomGraphics != null)
            {
                if (!_isCustomGraphicsDrawingStarted)
                {
                    _drawingCustomGraphics.StartDraw(startPoint.Value);
                    _isCustomGraphicsDrawingStarted = true;
                }
            }
            else if (pointerAction == PointerAction.None)
            {
                SelectGraphic(startPoint.Value);
                if (!IsInteractiveSelectedChanged && !IsUpdatingGraphicLocation())
                {
                    midPoint      = null;
                    pointerAction = PointerStartAction;

                    if (pointerAction == PointerAction.Measure)
                    {
                        if (MeasureGraphics != null)
                        {
                            MeasureGraphics.StartDraw(startPoint.Value);
                        }
                    }
                }
            }
        }