New to Telerik UI for .NET MAUIStart a free 30-day trial

.NET MAUI Map Commands

The Telerik UI for .NET MAUI Map control provides the following commands of type ICommand which handle the zoom level of the visualized shapes:

  • ZoomInCommand

  • ZoomOutCommand

You can manually call these commands, for example on button click action, to zoom-in or zoom-out respectively, the shapes displayed in RadMap.

Following is a quick example on how the commands of the Map control can be called from external UI:

1. The RadMap definition:

xaml
<telerik:RadMap x:Name="map" MinZoomLevel="2" MaxZoomLevel="5">
    <telerik:RadMap.Layers>
        <telerik:MapShapefileLayer>
            <telerik:MapShapefileLayer.Reader>
                <telerik:MapShapeReader x:Name="reader"/>
            </telerik:MapShapefileLayer.Reader>
        </telerik:MapShapefileLayer>
    </telerik:RadMap.Layers>
</telerik:RadMap>

2. Where the Source of the MapShapeReader is defined like this:

c#
var assembly = this.GetType().Assembly;
var source = MapSource.FromResource("SDKBrowserMaui.Examples.MapControl.world.shp", assembly);
this.reader.Source = source;

3. Add two buttons that will execute the Map commands - their Command property is bound to the corresponding Zoom command of the Map instance:

XAML
<Button Text="Zoom In" Command="{Binding Source={x:Reference map}, Path=ZoomInCommand}"/>
<Button Text="Zoom Out" Command="{Binding Source={x:Reference map}, Path=ZoomOutCommand}"/>

4. And the namespace for RadMap:

XAML
xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui"

See Also

In this article
See Also
Not finding the help you need?
Contact Support