Commands

RadMap provides the following commands of type ICommand:

  • ZoomInCommand
  • ZoomOutCommand

You could manually call these commands, for example on button click action, to update the zoom level of the shapes displayed in RadMap.

Following is a quick example on how the commands of the Map control can be used.

Let's have the following Map definition:

<telerikMap:RadMap x:Name="map" MinZoomLevel="2" MaxZoomLevel="5">
    <telerikMap:RadMap.Layers>
        <telerikMap:ShapefileLayer>
            <telerikMap:ShapefileLayer.Reader>
                <telerikMap:MapShapeReader x:Name="reader"/>
            </telerikMap:ShapefileLayer.Reader>
        </telerikMap:ShapefileLayer>
    </telerikMap:RadMap.Layers>
</telerikMap:RadMap>

where the Source of the MapShapeReader is defined like this:

var source = MapSource.FromResource("SDKBrowser.Examples.MapControl.world.shp");
this.reader.Source = source;

Lastly, use the following snippet to add two buttons that will execute the Map commands:

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

See Also

In this article
Not finding the help you need? Improve this article