MapPolygon MapPolygon MapPolygon MapPolygon Class

Definition

Represents a polygon on a MapControl.

public : sealed class MapPolygon : MapElement, IMapPolygon, IMapPolygon2public sealed class MapPolygon : MapElement, IMapPolygon, IMapPolygon2Public NotInheritable Class MapPolygon Inherits MapElement Implements IMapPolygon, IMapPolygon2// This API is not available in Javascript.
Inheritance
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Inherited Members

Inherited methods

Inherited properties

Remarks

Display pushpins, images, and shapes on the MapControl by adding them to its MapElements collection.

  • Display an image such as a pushpin with optional text by using the MapIcon class. Keep the default image or provide a custom image.
  • Define and display a MapPolygon or a MapPolyline. Alternately, to display XAML elements on the MapControl, add them to its Children collection.

For more info, see Display maps with 2D, 3D, and Streetside views.

Constructors

MapPolygon() MapPolygon() MapPolygon() MapPolygon()

Initializes a new instance of the MapPolygon class.

public : MapPolygon()public MapPolygon()Public Sub New()// This API is not available in Javascript.
See Also

Properties

FillColor FillColor FillColor FillColor

Gets or sets the color used to fill the MapPolygon.

public : Color FillColor { get; set; }public Color FillColor { get; set; }Public ReadWrite Property FillColor As Color// This API is not available in Javascript.
Value
Color Color Color Color

The color to be used to fill the MapPolygon.

See Also

Path Path Path Path

Gets or sets the collection of coordinates that define the MapPolygon shape.

Note

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

public : Geopath Path { get; set; }public Geopath Path { get; set; }Public ReadWrite Property Path As Geopath// This API is not available in Javascript.
Value
Geopath Geopath Geopath Geopath

The collection of coordinates that define the MapPolygon shape.

See Also

PathProperty PathProperty PathProperty PathProperty

Identifies the Path dependency property.

public : static DependencyProperty PathProperty { get; }public static DependencyProperty PathProperty { get; }Public Static ReadOnly Property PathProperty As DependencyProperty// This API is not available in Javascript.
Value
DependencyProperty DependencyProperty DependencyProperty DependencyProperty

The identifier for the Path dependency property.

See Also

Paths Paths Paths Paths

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; }public IList<Geopath> Paths { get; }Public ReadOnly Property Paths As IList<Geopath>// This API is not available in Javascript.
Value
IVector<Geopath> IList<Geopath> 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);

StrokeColor StrokeColor StrokeColor StrokeColor

Gets or sets the color used to draw the MapPolygon.

public : Color StrokeColor { get; set; }public Color StrokeColor { get; set; }Public ReadWrite Property StrokeColor As Color// This API is not available in Javascript.
Value
Color Color Color Color

The color to be used to draw the MapPolygon.

See Also

StrokeDashed StrokeDashed StrokeDashed StrokeDashed

Gets or sets a value that indicates whether the line used to draw the MapPolygon is dashed.

public : PlatForm::Boolean StrokeDashed { get; set; }public bool StrokeDashed { get; set; }Public ReadWrite Property StrokeDashed As bool// This API is not available in Javascript.
Value
PlatForm::Boolean bool bool bool

true if the line used for drawing the MapPolygon is dashed; otherwise, false.

See Also

StrokeDashedProperty StrokeDashedProperty StrokeDashedProperty StrokeDashedProperty

Identifies the StrokeDashed dependency property.

public : static DependencyProperty StrokeDashedProperty { get; }public static DependencyProperty StrokeDashedProperty { get; }Public Static ReadOnly Property StrokeDashedProperty As DependencyProperty// This API is not available in Javascript.
Value
DependencyProperty DependencyProperty DependencyProperty DependencyProperty

The identifier for the StrokeDashed dependency property.

See Also

StrokeThickness StrokeThickness StrokeThickness StrokeThickness

Gets or sets the width of the line used to draw the MapPolygon, in logical pixels.

public : double StrokeThickness { get; set; }public double StrokeThickness { get; set; }Public ReadWrite Property StrokeThickness As double// This API is not available in Javascript.
Value
double double double double

The width of the line used to draw the MapPolygon, in logical pixels.

See Also

StrokeThicknessProperty StrokeThicknessProperty StrokeThicknessProperty StrokeThicknessProperty

Identifies the StrokeThickness dependency property.

public : static DependencyProperty StrokeThicknessProperty { get; }public static DependencyProperty StrokeThicknessProperty { get; }Public Static ReadOnly Property StrokeThicknessProperty As DependencyProperty// This API is not available in Javascript.
See Also

See Also