This topic provides information on how to use markers in geographic series of the XamGeographicMap™ control.
The following table lists the topics required as a prerequisite to understanding this topic.
This topic contains the following sections:
In the XamGeographicMap control, markers are visual elements that display values of data items bound to geographic series in geographic locations of the map. Marker can be represented as labels, symbols or custom data templates.
The following types of geographic series support markers:
The following table maps the desired configuration to property settings of geographic series.
The screenshot below demonstrates how the XamGeographicMap control looks as a result of the following settings:
The following code changes the appearance of markers in the GeographicSymbolSeries
In XAML:
<ig:XamGeographicMap.Series>
<ig:GeographicSymbolSeries ItemsSource="{StaticResource shapefileConverter}"
MarkerBrush="Blue"
MarkerOutline="Black"
MarkerCollisionAvoidance="None"
LongitudeMemberPath="Points[0][0].X"
LatitudeMemberPath="Points[0][0].Y">
</ig:GeographicSymbolSeries>
</ig:XamGeographicMap.Series>
In C#:
var geoSeries = new GeographicSymbolSeries();
geoSeries.ItemsSource = shapefileConverter;
geoSeries.MarkerBrush = new SolidBrush(Color.Blue);
geoSeries.MarkerOutline = new SolidBrush(Color.Black);
geoSeries.MarkerCollisionAvoidance = CollisionAvoidanceType.None;
geoSeries.LatitudeMemberPath = "Points[0][0].X";
geoSeries.LongitudeMemberPath = "Points[0][0].Y";
this.geoMap.Series.Add(geoSeries);
In VB:
Dim geoSeries = new GeographicSymbolSeries()
geoSeries.ItemsSource = shapefileConverter
geoSeries.MarkerBrush = new SolidBrush(Color.Blue)
geoSeries.MarkerOutline = new SolidBrush(Color.Black)
geoSeries.MarkerCollisionAvoidance = CollisionAvoidanceType.None
geoSeries.LatitudeMemberPath = "Points[0][0].X"
geoSeries.LongitudeMemberPath = "Points[0][0].Y"
Me.geoMap.Series.Add(geoSeries)
The MarkerTemplate property of geographic series can be used to provide custom data templates to display custom symbols and/or values of data items. Custom data templates can access values of data items bound to the ItemsSource property of geographic series by binding to the Item property. When a geographic series is bound to the ShapefileConverter then the Item property is resolved to a ShapefileRecord object and values loaded from a shape database (.dbf) file can be accessed through the Fields property.
The following is a preview of the XamGeographicMap control with markers displaying names of countries on all shapes of GeographicShapeSeries.
The following code creates a custom data template for markers of GeographicShapeSeries with binding to a data column that contains names of countries.
In XAML:
<ig:GeographicShapeSeries ItemsSource="{StaticResource shapefileConverter}"
ShapeMemberPath="Points"
MarkerCollisionAvoidance="Fade">
<ig:GeographicShapeSeries.MarkerTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Item.Fields[CNTRY_NAME]}" FontWeight="Bold" />
</DataTemplate>
</ig:GeographicShapeSeries.MarkerTemplate>
</ig:GeographicShapeSeries>
The following topics provide additional information related to this topic.