Export (0) Print
Expand All

MapPolygon class

Bing

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

Constructor

Definition Description

MapPolygon()

Initializes a new instance of the MapPolygon class.

Public Properties

Name Type Description

FillColor

Color

Gets or sets the color to use to fill the polygon.

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.

Events

Name Arguments Description

PointerEntered

(Inherited from MapShape) Occurs when the pointer moves into the polygon.

PointerExited

(Inherited from MapShape) Occurs when the pointer moves out of the polygon.

PointerMoved

(Inherited from MapShape) Occurs when the pointer moves when it is inside the polygon.

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-filled shape to a map using XAML.

<bm:Map>
  <bm:Map.ShapeLayers>
    <bm:MapShapeLayer>
      <bm:MapShapeLayer.Shapes>
        <bm:MapPolygon FillColor="Red">
          <bm:MapPolygon.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:MapPolygon.Locations>
        </bm:MapPolygon>
      </bm:MapShapeLayer.Shapes>
    </bm:MapShapeLayer>
  </bm:Map.ShapeLayers>
</bm:Map>

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

MapShapeLayer shapeLayer = new MapShapeLayer();
MapPolygon polygon = new MapPolygon();
polygon.Locations = new LocationCollection() { new Location(44, -107), new Location(44, -110), new Location(46, -110), new Location(46, -107) };
polygon.FillColor = Windows.UI.Colors.Red;
shapeLayer.Shapes.Add(polygon);
map.ShapeLayers.Add(shapeLayer);

See Also

Show:
© 2014 Microsoft