Map Shape Labels

Labels for map shapes can be displayed using the LabelPath of ShapeFileLayer. The value of LabelPath must be a field name specified in the .dbf file corresponding to the shapefile.

Property Type Description
LabelPath string Gets or sets the field name in the database (.dbf) file.
  • html
  • <syncfusion:SfMap>
    
            <syncfusion:SfMap.Layers>
    
                <syncfusion:ShapeFileLayer x:Name="shapeFileLayer"   
    
                                           Uri="DBFLabelDemo_WinRT.Assets.Continent.shp"                                                               
    
                                           LabelPath="CONTINENT" FontSize="14">
    
                </syncfusion:ShapeFileLayer>
    
            </syncfusion:SfMap.Layers>
    
        </syncfusion:SfMap>

    The labels can also be customized by modifying the ItemsTemplate of ShapeFileLayer. The labels can be accessed using DBFData as follows:

  • html
  • <syncfusion:SfMap>
    
            <syncfusion:SfMap.Layers>
    
                <syncfusion:ShapeFileLayer x:Name="shapeFileLayer" 
    
                                           Uri="DBFLabelDemo_WinRT.Assets.Continent.shp"
    
                                           LabelPath="CONTINENT">
    
                    <syncfusion:ShapeFileLayer.ItemsTemplate>
    
                        <DataTemplate>
    
                            <Grid Background="Gray" Opacity="0.75">
    
                                <TextBlock Text="{Binding DBFData[CONTINENT]}"
    
                                           FontSize="14" Margin="10 5"/>
    
                            </Grid>
    
                        </DataTemplate>
    
                    </syncfusion:ShapeFileLayer.ItemsTemplate>
    
                </syncfusion:ShapeFileLayer>
    
            </syncfusion:SfMap.Layers>
    
        </syncfusion:SfMap>

    Map with Labels