We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

ZoomLevel and GeoCoordinates bindable?

I want to save the current ZoomLevel and GeoCoordinates, so that the next time the app is started the map displays the area the user was last viewing.

When I try binding these properties, the map does not display. Are they bindable? If not, how can I retrieve them?

Regards,

James

1 Reply

RA Rachel A Syncfusion Team June 19, 2019 01:33 PM UTC

Hi James, 
 
Thanks for your interest in Syncfusion products. 
 
ZoomLevel and GeoCoordinates properties are bindable properties but does not provide two-way binding. Instead, you can get the current ZoomLevel from the ZoomLevelChanging event’s argument of e.CurrentLevel and get the current GeoCoordinates from the GeoCoordinateChanged event’s arguments of e.Center as like the below code snippet. 
 
[XAML] 
 
 
   <maps:ImageryLayer LayerType="OSM" 
                      GeoCoordinateChanged="ImageryLayer_GeoCoordinateChanged" 
                      ZoomLevelChanging="ImageryLayer_ZoomLevelChanging"/> 
 
 
C#: 
 
 
  private void ImageryLayer_GeoCoordinateChanged(object sender, Syncfusion.SfMaps.XForms.GeoCoordinateChangedEventArgs e) 
        { 
            geoPoints.Text = e.Center.X.ToString() + "," + e.Center.Y.ToString(); 
        } 
 
        private void ImageryLayer_ZoomLevelChanging(object sender, Syncfusion.SfMaps.XForms.ZoomLevelChangingEventArgs e) 
        { 
            resetZoom.Text = e.CurrentLevel.ToString(); 
        } 
 
 
 
We have prepared the sample for your reference. Please find the sample from the following location. 
 
 
Please refer the UG link for more information about this. 
 
 
Thanks, 
Rachel. 


Loader.
Up arrow icon