void LoadMarkersToMap() { MainMap.Markers.Clear(); // set current marker currentMarker = new GMapMarker(MainMap.Position); { currentMarker.Shape = new Marker_Current(this, currentMarker, "custom position marker"); currentMarker.Offset = new System.Windows.Point(-10, -10); currentMarker.ZIndex = int.MaxValue; MainMap.Markers.Add(currentMarker); } foreach (Marker m in _MarkerCollection) { if ((bool)LayerCollection.Single(l => l.LayerID.ToString() == m.LayerID).IsLayerShown) { if (m.MarkerType == 1) { List <PointLatLng> coordlist = new List <PointLatLng>(); foreach (Polygon p in _PolygonCollection) { if (p.MarkerID == m.MarkerID.ToString()) { coordlist.Add(new PointLatLng(p.Lat, p.Lng)); } } BrushConverter bc = new BrushConverter(); Brush color = (Brush)bc.ConvertFrom(LayerCollection.Single(l => l.LayerID.ToString() == m.LayerID).LayerColor); AddPolygon(coordlist, new PointLatLng(m.MarkerLat, m.MarkerLng), color, color); } else if (m.MarkerType == 2) { List <PointLatLng> coordlist = new List <PointLatLng>(); foreach (Polygon p in _PolygonCollection) { if (p.MarkerID == m.MarkerID.ToString()) { coordlist.Add(new PointLatLng(p.Lat, p.Lng)); } } BrushConverter bc = new BrushConverter(); Brush color = (Brush)bc.ConvertFrom(LayerCollection.Single(l => l.LayerID.ToString() == m.LayerID).LayerColor); AddPolyline(coordlist, new PointLatLng(m.MarkerLat, m.MarkerLng), color); } GMapMarker marker = new GMapMarker(new PointLatLng(m.MarkerLat, m.MarkerLng)); string ToolTipText; ToolTipText = "Név: " + m.MarkerName + "\nGEO: " + m.MarkerGEO + "\nMegj.: " + m.MarkerNote; marker.Shape = new CustomMarkerDemo(this, marker, ToolTipText); marker.ZIndex = 55; marker.Tag = m.MarkerID.ToString(); MainMap.Markers.Add(marker); } } }