public void MouseClicked(object sender, MouseButtonEventArgs e) { System.Windows.Controls.Image image = (System.Windows.Controls.Image)sender; System.Windows.Point point = e.GetPosition(image); double xRatio = point.X / image.ActualWidth; double yRatio = point.Y / image.ActualHeight; AddUndoAction(SelectedWhiskerPoint.Clone()); SelectedWhiskerPoint.XRatio = xRatio; SelectedWhiskerPoint.YRatio = yRatio; SelectedWhiskerPoint.CanvasWidth = image.ActualWidth; SelectedWhiskerPoint.CanvasHeight = image.ActualHeight; NotifyPropertyChanged("Whiskers"); ExportCommand.RaiseCanExecuteChangedNotification(); if (AutoNextPoint) { IncreaseWhiskerCounter(); } }