public void Handle(DrawRouteEvent message) { var lines = new MapPolylineCollection(); var routePoints = message.DrawRoute.RoutePoints; var points = routePoints.Select(routePoint => new Point(routePoint.Longitude, routePoint.Latitude)).ToList(); lines.Add(XamRouteMap.MapProjection.ProjectToMap(points)); var lineElement = new PathElement() { Polylines = lines }; var brushConverter = new BrushConverter(); lineElement.Fill = brushConverter.ConvertFromString(message.DrawRoute.RouteColour) as SolidColorBrush; lineElement.StrokeThickness = 3; XamRouteMap.Layers[1].Elements.Add(lineElement); var worldRect = XamRouteMap.WorldRect; lineElement.WorldRect = worldRect; } public void Handle(DrawVehicleEvent message) { var vehicle = message.DrawVehicle; var geoLocation = message.VehicleLocation; // Get Point data using a projection from Geodetic to Cartesian coordinates var vehicleLocation = XamRouteMap.MapProjection.ProjectToMap(geoLocation.ToPoint()); var vehicleTracker = new SymbolElement { Name = vehicle.RegistrationNumber, Caption = vehicle.RegistrationNumber, FontSize = 10, Foreground = new SolidColorBrush(Colors.Green), Stroke = new SolidColorBrush(Colors.Green), StrokeThickness = 2, SymbolOrigin = vehicleLocation, SymbolType = MapSymbolType.None, SymbolSize = 5 }; var findVehicle = XamRouteMap.Layers[2].Elements.FirstOrDefault(v => v.Name == vehicle.RegistrationNumber); if (findVehicle != null) XamRouteMap.Layers[2].Elements.Remove(findVehicle); vehicleTracker.WorldRect = XamRouteMap.WorldRect; XamRouteMap.Layers[2].Elements.Add(vehicleTracker); }