示例#1
0
        public override void ChangedDragState(MKMapView mapView, MKAnnotationView annotationView, MKAnnotationViewDragState newState, MKAnnotationViewDragState oldState)
        {
            if (annotationView.Annotation is BindingMKAnnotation annotation)
            {
                switch (newState)
                {
                case MKAnnotationViewDragState.Starting:
                    if (MarkerDragStart?.CanExecute(annotation.Annotation) ?? false)
                    {
                        MarkerDragStart.Execute(annotation.Annotation);
                    }
                    break;

                case MKAnnotationViewDragState.Ending:
                    if (MarkerDragEnd?.CanExecute(annotation.Annotation) ?? false)
                    {
                        MarkerDragEnd.Execute(annotation.Annotation);
                    }
                    break;

                case MKAnnotationViewDragState.Dragging:
                    if (MarkerDrag?.CanExecute(annotation.Annotation) ?? false)
                    {
                        MarkerDrag.Execute(annotation.Annotation);
                    }
                    break;
                }
            }
        }
示例#2
0
        public void OnMarkerDrag(Marker marker)
        {
            var mAnnotation = (marker.Tag as AnnotationTag).Annotation;

            if (mAnnotation is IBindingMapAnnotation anno)
            {
                anno.Location = marker.Position.ToBinding2DLocation();
                if (MarkerDrag?.CanExecute(anno) ?? false)
                {
                    MarkerDrag.Execute(anno);
                }
            }
        }