protected override void OnElementChanged(ElementChangedEventArgs <CusMapView> e) { base.OnElementChanged(e); if (e.OldElement != null) { } CusMapView currentElement = e.NewElement; if (currentElement != null) { _originMapView = _adapter.Adapter(currentElement); } if (Control == null) { SetNativeControl(_originMapView); } }
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); } }