This topic is dedicated to providing a quick overview of the XAML used to complete various tasks. For more information, see the Maps for WPF and Silverlight Task-Based Help section.
Item Template
The following example illustrates how to use the maps item template:
XAML |
Copy Code
|
---|---|
<c1: x:Name="C1Maps1" FadeInTiles="False" Margin="0,0,235,8" TargetCenter="-65,-25" Center="-58,-25" Zoom="2" Foreground="Aqua"> <c1:C1Maps.Resources> <!--Item template --> <DataTemplate x:Key="templPts"> <c1:C1VectorPlacemark GeoPoint="{Binding Path=LongLat}" Fill="Aqua" Stroke="Aqua" Label="{Binding Path=Name}" LabelPosition="Top" > <c1:C1VectorPlacemark.Geometry> <EllipseGeometry RadiusX="2" RadiusY="2" /> </c1:C1VectorPlacemark.Geometry> </c1:C1VectorPlacemark> </DataTemplate> </c1:C1Maps.Resources> <c1:C1VectorLayer ItemsSource="{Binding}" ItemTemplate="{StaticResource templPts}" HorizontalAlignment="Right" Width="403" /> </c1> |
Vector Layer Label
The following example illustrates how to create labels using the vector layer:
XAML |
Copy Code
|
---|---|
<c1:C1Maps> <c1:C1VectorLayer> <c1:C1VectorPlacemark LabelPosition="Left" GeoPoint="-80.107008,42.16389" StrokeThickness="2" Foreground="#FFEB1212" PinPoint="-80.010866,42.156831" Label="Erie, PA"/> </c1:C1VectorLayer> |
VectorLayer – Polyline
The following example illustrates how to create a polyline (an open line) using the vector layer:
XAML |
Copy Code
|
---|---|
<c1:C1Maps> <c1:C1VectorLayer Margin="2,0,-2,0"> <c1:C1VectorPolyline Points="-80.15,42.12 -123.08,39.09, -3.90,30.85" StrokeThickness="3" Stroke="Red"> </c1:C1VectorPolyline> </c1:C1VectorLayer> </c1:C1Maps> |
Vector Layer – Polygon
The following example illustrates how to create a polyline (a line that creates a shape) using the vector layer:
XAML |
Copy Code
|
---|---|
<c1:C1Maps> <c1:C1VectorLayer Margin="2,0,-2,0"> <c1:C1VectorPolygon Points="-80.15,42.12 -123.08,39.09, -3.90,30.85" StrokeThickness="3" Stroke="Red"> </c1:C1VectorPolygon> </c1:C1VectorLayer> </c1:C1Maps> |
Theming
The following example illustrates how to apply a theme to the C1Maps control:
XAML |
Copy Code
|
---|---|
<my:C1ThemeRainierOrange> <c1:C1Maps Height="172" Width="288" Margin="200,0,34,0"/> </my:C1ThemeRainierOrange> |