Map Shape Labels in WPF Maps (SfMap)
1 Dec 2020 / 3 minutes to read
Labels for map shapes can be displayed by 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. |
<syncfusion:SfMap>
<syncfusion:SfMap.Layers>
<syncfusion:ShapeFileLayer x:Name="shapeFileLayer"
Uri="DataMarkers.ShapeFiles.world1.shp"
LabelPath="NAME" 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 by using DBFData as follows:
<syncfusion:SfMap>
<syncfusion:SfMap.Layers>
<syncfusion:ShapeFileLayer Uri="DataMarkers.ShapeFiles.world1.shp"
LabelPath="NAME">
<syncfusion:ShapeFileLayer.ItemsTemplate>
<DataTemplate>
<Grid Background="Gray" Opacity="0.75">
<TextBlock Text="{Binding DbfData[NAME]}"
FontSize="14" Margin="10 5"/>
</Grid>
</DataTemplate>
</syncfusion:ShapeFileLayer.ItemsTemplate>
</syncfusion:ShapeFileLayer>
</syncfusion:SfMap.Layers>
</syncfusion:SfMap>
Was this page helpful?
Yes
No
Thank you for your feedback!
Thank you for your feedback and comments. We will rectify this as soon as possible!
An unknown error has occurred. Please try again.
Help us improve this page