Dela via


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:
 property IVector<Geopath ^> ^ Paths { IVector<Geopath ^> ^ get(); };
IVector<Geopath> Paths();
public IList<Geopath> Paths { get; }
var iVector = mapPolygon.paths;
Public ReadOnly Property Paths As IList(Of Geopath)

Property Value

A list of Geopath objects that define the MapPolygon shape.

Windows requirements

Device family
Windows 10 (introduced in 10.0.10586.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v2.0)

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);

Applies to