/// <summary> /// Override of <see cref="BehaviourBase"/> that handles a left mouse button press. /// This initiates the point move process allowing a user to alter the Y value of /// the selected point. /// </summary> /// <param name="position">The position on the mouse on click.</param> public override void MouseLeftButtonDown(Point position) { // Get the point that has been clicked on. GetSelectedPoint(position); // Check we can capture the mouse, otherwise the move is impossible. bool captured = BehaviourContainer.CaptureMouse(); if (captured && _selectedPoint != null) { _leftMouseDown = true; SetZoomEnabled(false); foreach (var child in this.BehaviourContainer.Children) { if (child is ZoomBehaviour) { (child as ZoomBehaviour).IsEnabled = false; break; } } // Change the point style by adding it to the Series SelectedItems list //((ChartSingleSeriesBase)Chart.Series[0]).SelectedItems.Add(_selectedPoint); // Change the cursor _currentCursor = Chart.Cursor; Chart.Cursor = Cursors.Hand; } }
public override void MouseLeftButtonDown(Point position) { if (Chart.XAxis.ActualRange == null || Chart.YAxis.ActualRange == null || !BehaviourContainer.CaptureMouse() || Keyboard.Modifiers == ModifierKeys.Shift) { return; } _leftMouseDown = true; _firstPosition = position; //Set the up the zoom rectangle _zoomRectangle.SetValue(Canvas.LeftProperty, position.X); _zoomRectangle.SetValue(Canvas.TopProperty, position.Y); _zoomRectangle.Width = 0; _zoomRectangle.Height = 0; if (_zoomRectangle.Border != null) { _zoomRectangle.Border.Background = _zoomRectangle.Background; _zoomRectangle.Border.BorderBrush = _zoomRectangle.Foreground; } //Make it visible _zoomRectangle.Visibility = Visibility.Visible; }
public override void MouseLeftButtonDown(Point position) { if (Chart.XAxis.ActualRange == null || Chart.YAxis.ActualRange == null || !BehaviourContainer.CaptureMouse()) { return; } _leftMouseDown = true; _firstPosition = position; //Set the up the zoom rectangle _selectionRectangle.SetValue(Canvas.LeftProperty, position.X); _selectionRectangle.SetValue(Canvas.TopProperty, UseFullYAxis ? 0 : position.Y); _selectionRectangle.Width = 0; _selectionRectangle.Height = UseFullYAxis ? BehaviourContainer.ActualHeight : 0; if (_selectionRectangle.Border != null) { _selectionRectangle.Border.Background = new SolidColorBrush(new Color { A = 60, R = 255, B = 0, G = 0 }); _selectionRectangle.Border.BorderBrush = new SolidColorBrush(new Color { A = 255, R = 255, B = 0, G = 0 }); } //Make it visible _selectionRectangle.Visibility = Visibility.Visible; }