private void DrawMapMarker(EventDescription coordinate, Color color, MapLayer mapLayer) { // Create a map marker PolygonDetails polygonDetails = new PolygonDetails(); polygonDetails.polygon = new Polygon(); polygonDetails.polygon.Points.Add(new Point(0, 0)); polygonDetails.polygon.Points.Add(new Point(0, 75)); polygonDetails.polygon.Points.Add(new Point(35, 0)); polygonDetails.polygon.Fill = new SolidColorBrush(color); // Enable marker to be tapped for location information polygonDetails.polygon.Tag = coordinate; polygonDetails.polygon.MouseLeftButtonUp += new MouseButtonEventHandler(Marker_Click1); // Create a MapOverlay and add marker. MapOverlay overlay = new MapOverlay(); overlay.Content = polygonDetails.polygon; overlay.GeoCoordinate = new GeoCoordinate(coordinate.geocoords.Latitude, coordinate.geocoords.Longitude); overlay.PositionOrigin = new Point(0.0, 1.0); mapLayer.Add(overlay); }
/// <summary> /// Helper method to draw a single marker on top of the map. /// </summary> /// <param name="coordinate">GeoCoordinate of the marker</param> /// <param name="color">Color of the marker</param> /// <param name="mapLayer">Map layer to add the marker</param> private void DrawMapMarker(GeoCoordinate coordinate, Color color, MapLayer mapLayer) { // Create a map marker PolygonDetails polygonDetails = new PolygonDetails(); polygonDetails.polygon = new Polygon(); polygonDetails.polygon.Points.Add(new Point(0, 0)); polygonDetails.polygon.Points.Add(new Point(0, 75)); polygonDetails.polygon.Points.Add(new Point(25, 0)); polygonDetails.polygon.Fill = new SolidColorBrush(color); // Create a MapOverlay and add marker. MapOverlay overlay = new MapOverlay(); overlay.Content = polygonDetails.polygon; overlay.GeoCoordinate = new GeoCoordinate(coordinate.Latitude, coordinate.Longitude); overlay.PositionOrigin = new Point(0.0, 1.0); mapLayer.Add(overlay); }