MapPolygon.Paths MapPolygon.Paths MapPolygon.Paths MapPolygon.Paths Property

Definition

Gets a list of Geopath objects that define the MapPolygon shape.

Note

In Windows 10, version 1511, we recommend using this property instead of Path to create polygons. Do not use both properties (Paths and Path ) at the same time.

public : IVector<Geopath> Paths { get; }
IVector<Geopath> Paths();
public IList<Geopath> Paths { get; }
Public ReadOnly Property Paths As IList<Geopath>

Property Value

IList<Geopath> IList<Geopath>

A list of Geopath objects that define the MapPolygon shape.

Additional features and requirements

Device family
Windows 10 (introduced v10.0.10586.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v2)

Remarks

This property allows the MapPolygon to be defined by one or more Geopath objects. With multiple geopaths, you can create complex shapes, such as a polygon with a hole in it.

In this example, a MapPolygon is created in the shape of a polygon with a hole in it.

var pathPositions = new List<BasicGeoposition>();

pathPositions.Add(new BasicGeoposition() { Latitude = 0, Longitude = 0 });
pathPositions.Add(new BasicGeoposition() { Latitude = 1, Longitude = 0 });
pathPositions.Add(new BasicGeoposition() { Latitude = 1, Longitude = 1 });
pathPositions.Add(new BasicGeoposition() { Latitude = 0, Longitude = 1 });

var interiorPositions = new List<BasicGeoposition>();

interiorPositions.Add(new BasicGeoposition() { Latitude = 0.2, Longitude = 0.2 });
interiorPositions.Add(new BasicGeoposition() { Latitude = 0.4, Longitude = 0.2 });
interiorPositions.Add(new BasicGeoposition() { Latitude = 0.4, Longitude = 0.4 });
interiorPositions.Add(new BasicGeoposition() { Latitude = 0.2, Longitude = 0.4 });

var mp = new MapPolygon();

mp.Paths.Add(new Geopath(pathPositions));
mp.Paths.Add(new Geopath(interiorPositions));

this.maps.MapElements.Add(mp);