public MGLAnnotationView MapView_ViewForAnnotation(MGLMapView mapView, IMGLAnnotation annotation) { var fannotation = Element.Annotations.FirstOrDefault(x => x.NativeHandle == annotation.Handle); switch (fannotation) { case SymbolAnnotation symbol: if (symbol.IconImage?.Source != null) { return null; } break; } var annotationView = mapView.DequeueReusableAnnotationViewWithIdentifier("draggablePoint"); if (annotationView != null) return annotationView; var view = new DraggableAnnotationView(reuseIdentifier: "draggablePoint", size: 24); view.DragFinished += (sender, e) => { var point = new SymbolAnnotation(); point.NativeHandle = annotation.Handle; point.Coordinates = annotation.Coordinate.ToLatLng(); Element.DragFinishedCommand?.Execute(point); }; view.AddGestureRecognizer(new UITapGestureRecognizer(tap => { Element.DidTapOnMarkerCommand?.Execute(fannotation.Id); })); //mapView.SelectAnnotation(annotation, true, null); return view; }
public MGLAnnotationView MapView_ViewForAnnotation(MGLMapView mapView, IMGLAnnotation annotation) { var fannotation = Element.Annotations.FirstOrDefault(x => x.NativeHandle == annotation.Handle); switch (fannotation) { case SymbolAnnotation symbol: if (symbol.IconImage?.Source != null) { return(null); } break; } var annotationView = mapView.DequeueReusableAnnotationViewWithIdentifier("draggablePoint"); if (annotationView != null) { return(annotationView); } var view = new DraggableAnnotationView(reuseIdentifier: "draggablePoint", size: 24); view.DragFinished += (sender, e) => { var point = new SymbolAnnotation(); point.NativeHandle = annotation.Handle; point.Coordinates = annotation.Coordinate.ToLatLng(); Element.DragFinishedCommand?.Execute(point); }; return(view); }