protected override void OnElementChanged(ElementChangedEventArgs <CusMapView> e) { base.OnElementChanged(e); if (e.OldElement != null) { Control.GeoViewTapped -= OnGeoViewTapped; Control.GeoViewDoubleTapped -= OnGeoViewDoubleTapped; Control.GeoViewHolding -= OnGeoViewHolding; Control.NavigationCompleted -= OnNavigationCompleted; Control.SpatialReferenceChanged -= OnSpatialReferenceChanged; Control.DrawStatusChanged -= OnDrawStatusChanged; Control.LayerViewStateChanged -= OnLayerViewStateChanged; Control.Drag -= OnMapDrag; Control.Touch -= OnMapTouch; MessagingCenter.Unsubscribe <GeoView>(this, Constants.MessageCenterKeys.ShowCalloutAtKey); } CusMapView currentElement = e.NewElement; if (currentElement != null) { _originMapView = _adapter.Adapter(currentElement); if (Control == null) { SetNativeControl(_originMapView); } EsriEnumConverter.Init(_originMapView); Control.GeoViewTapped += OnGeoViewTapped; Control.GeoViewDoubleTapped += OnGeoViewDoubleTapped; Control.GeoViewHolding += OnGeoViewHolding; Control.NavigationCompleted += OnNavigationCompleted; Control.SpatialReferenceChanged += OnSpatialReferenceChanged; Control.DrawStatusChanged += OnDrawStatusChanged; Control.LayerViewStateChanged += OnLayerViewStateChanged; Control.Drag += OnMapDrag; Control.Touch += OnMapTouch; MessagingCenter.Subscribe <GeoView, Controls.CalloutDefinition>(this, Constants.MessageCenterKeys.ShowCalloutAtKey, ShowCallout); } }
private void OnMapDrag(object sender, DragEventArgs e) { Element.OnDrag(sender, EsriEnumConverter.ConvertFrom(e)); }
private void OnMapTouch(object sender, TouchEventArgs e) { Element.OnTouch(sender, EsriEnumConverter.ConvertFrom(e)); }