public bool ContainsMarker(Marker marker) => _markers.Contains(marker);
 public void RemoveMarker(Marker marker)
 {
     _markers.Remove(marker);
 }
 public void AddMarker(Marker marker)
 {
     _markers.Add(marker);
 }
        private void UpdateMarkerControlPosition(Marker marker)
        {
            var screenPos = _mapControl.FromLatLngToLocal(marker.MapMarker.Position);

            Canvas.SetLeft(marker.MarkerControl, screenPos.X - (marker.MarkerControl as FrameworkElement).Width / 2);
            Canvas.SetTop(marker.MarkerControl, screenPos.Y - (marker.MarkerControl as FrameworkElement).Height / 2);
        }
 public void RemoveMarker(Marker marker)
 {
     _overlays.First(o => o.ContainsMarker(marker)).RemoveMarker(marker);
 }
        public void AddMarker(UIElement control, string overlayName, PointLatLng position)
        {
            var overlay = _overlays.FirstOrDefault(o => o.Name == overlayName);
            if(overlay == null) throw new ArgumentException("Overlay with given name doesn't exist.");

            var marker = new Marker(control, new GMapMarker(position));

            overlay.AddMarker(marker);
            _markerCanvas.Children.Add(control);

            // Sends scrolls on markers to Map
            control.PreviewMouseWheel += (s, args) =>
            {
                if (args.Handled) return;
                args.Handled = true;

                _mapControl.Zoom += args.Delta > 0 ? 1 : -1;
            };

            UpdateMarkerControlPosition(marker);
        }