Share via


MapControl.TryZoomInAsync Method

Definition

Starts an asynchronous operation to zoom in, increasing the map's ZoomLevel by one.

public:
 virtual IAsyncOperation<bool> ^ TryZoomInAsync() = TryZoomInAsync;
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperation<bool> TryZoomInAsync();
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperation<bool> TryZoomInAsync();
function tryZoomInAsync()
Public Function TryZoomInAsync () As IAsyncOperation(Of Boolean)

Returns

Contains the results of the operation: true if the operation completed successfully; otherwise, false.

Attributes

Remarks

Warning

We don't recommend changing ZoomLevel with 3D views. When the MapControl's view is not looking "straight-down," changes in ZoomLevel can lead to unpredictable behavior.

ZoomLevel is intended for 2D views. To implement a "zoom" effect with 3D views, use the MapControl's TrySetSceneAsync method to move the camera closer. Start by setting a closer Location on a MapCamera object. Next, create a new MapScene by passing that MapCamera to CreateFromCamera. Finally, initiate the zoom by passing the new MapScene to TrySetSceneAsync. You can zoom in immediately or specify MapAnimationKind to create an animated "fly in".

The maximum and minimum values of ZoomLevel, which are reported by the MaxZoomLevel and MinZoomLevel properties, depend on the type of map view: 2D, 3D, or Streetside.

Property2D range3D rangeStreetside range
ZoomLevel1-201-2024-26

When leaving a Streetside view, the map returns to the previous view settings. The Streetside ZoomLevel is not maintained outside of the Streetside experience.

Consider this method when you want to replace the default UI control with your own.

Applies to