protected override void OnPoint_PositionChanged(object sender, PositionChangedEventArgs e) { DraggablePoint marker = (DraggablePoint)sender; // adjusting position to fit inside allowed region var region = AllowedRegion; var position = e.Position; if (position.X < region.XMin) { position.X = region.XMin; } if (position.Y < region.YMin) { position.Y = region.YMin; } if (position.X > region.XMax) { position.X = region.XMax; } if (position.Y > region.YMax) { position.Y = region.YMax; } marker.Position = position; marker.DataContext = position; var index = MarkerChartBase.GetIndex(marker); if (0 <= index && index < Points.Count && !ProtectedPoints.Changing) { Points[index] = position; } }
protected virtual void OnPoint_PositionChanged(object sender, PositionChangedEventArgs e) { FrameworkElement marker = (FrameworkElement)sender; var index = MarkerChartBase.GetIndex(marker); marker.DataContext = e.Position; if (0 <= index && index < points.Count && !points.Changing) { points[index] = e.Position; } }
private void element_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { FrameworkElement clickedElement = (FrameworkElement)sender; int index = MarkerChartBase.GetIndex(clickedElement); if (index >= 0) { Point point = selector.Points[index]; selector.Points.RemoveAt(index); //plotter.UndoProvider.AddAction(new CollectionRemoveAction<Point>(selector.Points, point, index)); e.Handled = true; } }