private void Shape_MouseMove(object sender, MouseEventArgs e) { Image i = sender as Image; if (i != null && e.LeftButton == MouseButtonState.Pressed) { var currentloc = e.GetPosition(Gmap); _foundLocation.Position = Gmap.FromLocalToLatLng((int)currentloc.X, (int)currentloc.Y); //DragDrop.DoDragDrop(i, _foundLocation, DragDropEffects.All); } }
private void Shape_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { Image i = sender as Image; if (i.IsMouseCaptured) { Mouse.Capture(null); } var currentloc = e.GetPosition(Gmap); var position = Gmap.FromLocalToLatLng((int)currentloc.X, (int)currentloc.Y); LocationToBeFoundY = position.Lat; LocationToBeFoundX = position.Lng; }
private void _showContextMenu(object sender, MouseButtonEventArgs e) { if (Keyboard.IsKeyDown(Key.LeftCtrl)) { var currentloc = e.GetPosition(Gmap); var position = Gmap.FromLocalToLatLng((int)currentloc.X, (int)currentloc.Y); var cm = new ContextMenu(); //cm.Items.Add(new MenuItem("Measure Distance From", new ErrorEventHandler(_addFromLocation))); var m1 = new MenuItem(); var m2 = new MenuItem(); m1.Header = "Measure Distance Location 1"; m1.Click += new RoutedEventHandler((s, ee) => _add1stLocation(s, ee, new LatLngPoint(position))); cm.Items.Add(m1); if (MeasureLocation1 != null) { m2.Header = "Measure Distance Location 2"; m2.Click += new RoutedEventHandler((s, ee) => _add2ndLocation(s, ee, new LatLngPoint(position))); cm.Items.Add(m2); } cm.IsOpen = true; } }