Hi, I'm using: SfMaps.Layer.MapTileLayer to load and display OSM maps, works fine!
Is there an event fired as soon as the map is loaded and going to be displayed?
I would like to set the center and zoomlevel just before the map is displayed.
Thanks fpr your answer!
Haimo
Hi Haimo,
Regarding “Need to set Center and Zoom just before map is displayed”:
Your requirement can be achieved using the SfMaps.Loaded event, where you can set the Center and ZoomLevel for the MapTileLayer, as shown in the following code snippet.
[C#]:
|
private void map_Loaded(object sender, EventArgs e) { this.tileLayer.Center = new MapLatLng(27.1751, 78.0421); MapZoomPanBehavior zoomPanBehavior = new MapZoomPanBehavior() { ZoomLevel = 4 }; this.tileLayer.ZoomPanBehavior = zoomPanBehavior; } |
We have prepared an example sample illustrating the above approach and attached it below for your reference. Please check the attached sample and let us know whether your requirement is achieved.
If you have any further questions or require assistance with any other aspect, please don't hesitate to let us know. We are here to help.
Regards,
Vishal O.
Hi Vishal,
thanks for the message and the example: Yes it works perfectly!
I was looking at this documentation but could not find any information about Events:
Regards,
Haimo
Hi Haimo,
We are glad that our suggested solution meets your requirement.
Regarding “could not find about events in the SfMaps API document page”:
As per the current implementation, the .NET MAUI SfMaps control does not have any inbuild events. However, it does inherit functionality from the framework's VisualElement class. This means you can leverage the Loaded event from the underlying VisualElement class within the .NET MAUI framework, which fires when the SfMaps control finishes loading.
Please note that our API documentation focuses on events that are specific to the SfMaps control itself. Framework-level events like Loaded are not explicitly documented as they are inherited behaviors.
If you have any further questions or require assistance with any other aspect, please don't hesitate to let us know. We are here to help.
Regards,
Vishal O.