private void map_MouseUp(object sender, MouseButtonEventArgs e) { if (inPushpinDrag && selectedPushpin != null) { inPushpinDrag = false; int oldPinIndex = route.IndexOf(oldPinLocation); route[oldPinIndex] = selectedPushpin.Location; DrawWayPoints(); } if (e.ChangedButton == MouseButton.Right) { ContextMenu cm = mainWindow.FindResource("cmMap") as ContextMenu; Location loc = map.ViewportPointToLocation(e.GetPosition(map)); cm.Placement = System.Windows.Controls.Primitives.PlacementMode.MousePoint; cm.DataContext = loc; cm.IsOpen = true; e.Handled = true; } }
private void Image_LeftButtonDown(object sender, MouseButtonEventArgs e) { startIndex = locations.IndexOf(MapLayer.GetPosition(((Image)sender))); }