Getting Started

This guide provides the information you need to start using the Telerik UI for .NET MAUI Map by adding the control to your project.

At the end, you will be able to achieve the following result.

Getting Started Example

Prerequisites

Before adding the Map, you need to:

  1. Set up your .NET MAUI application.

  2. Download Telerik UI for .NET MAUI.

  3. Install Telerik UI for .NET MAUI.

The Map is rendered through the SkiaSharp graphics library.

Define the Control

  1. When your .NET MAUI application is set up, you are ready to add a Map control to your page.

    <telerikMap:RadMap x:Name="map">
      <telerikMap:RadMap.Layers>
          <telerikMap:ShapefileLayer>
              <telerikMap:ShapefileLayer.Reader>
                  <telerikMap:MapShapeReader x:Name="reader"/>
              </telerikMap:ShapefileLayer.Reader>
          </telerikMap:ShapefileLayer>
      </telerikMap:RadMap.Layers>
    </telerikMap:RadMap>
    
  2. Add the following namespace:

     xmlns:telerikMap="clr-namespace:Telerik.XamarinForms.Map;assembly=Telerik.Maui.Controls.Compatibility"
    
  3. RadMap uses *.shp files that contain the coordinates of the shapes that will be drawn by the map and an optional *.dbf file for each *.shp file with additional attributes of the shapes.

    You would need to assign the .shp file containing the data through the Source property of the MapShapeReader like this:

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

    In the example the .shp file is loaded as an EmbeddedResource, there are other options as well, please check them in the ShapefileLayer topic.

See Also

In this article
Not finding the help you need?