Export (0) Print
Expand All

MapPolyline class

Bing

Represents a polyline on the map. This class inherits from MapMultiPoint.

Constructor

Definition Description

MapPolyline()

Initializes a new instance of the MapPolyline class.

Public Properties

Name Type Description

Color

Color

Gets or sets the color of the polyline.

Locations

LocationCollection

(Inherited from MapMultiPoint) Gets or sets the locations that define the shape.

Visible

bool

(Inherited from MapShape) Gets or sets whether the shape is shown on the map. To hide the shape, set this property to false.

Width

double

Gets or sets the width of the polyline, in pixels.

Events

Name Arguments Description

PointerEntered

(Inherited from MapShape) Occurs when the pointer moves onto the polyline.

PointerExited

(Inherited from MapShape) Occurs when the pointer moves off of the polyline.

PointerMoved

(Inherited from MapShape) Occurs when the pointer moves while it is on the polyline.

Tapped

(Inherited from MapShape) Occurs when an otherwise unhandled Tap action occurs over a hit test area of this shape.

Code Examples

Add a red shape to the map using XAML.

<bm:Map>
  <bm:Map.ShapeLayers>
    <bm:MapShapeLayer>
      <bm:MapShapeLayer.Shapes>
        <bm:MapPolyline Color="Red">
          <bm:MapPolyline.Locations>
            <bm:Location Latitude="0" Longitude="10" />
            <bm:Location Latitude="10" Longitude="10" />
            <bm:Location Latitude="10" Longitude="0" />
            <bm:Location Latitude="0" Longitude="0" />
          </bm:MapPolyline.Locations>
        </bm:MapPolyline>
      </bm:MapShapeLayer.Shapes>
    </bm:MapShapeLayer>
  </bm:Map.ShapeLayers>
</bm:Map>

Add a red shape to the map using code-behind.

MapShapeLayer shapeLayer = new MapShapeLayer();
MapPolyline polyline = new MapPolyline();
polyline.Locations = new LocationCollection() { new Location(44, -107), new Location(44, -110), new Location(46, -110), new Location(46, -107) };
polyline.Color = Windows.UI.Colors.Red;
polyline.Width = 5;
shapeLayer.Shapes.Add(polyline);
map.ShapeLayers.Add(shapeLayer);

Show:
© 2015 Microsoft