MapPolygon MapPolygon MapPolygon Class

Definition

Represents a polygon on a MapControl.

public : sealed class MapPolygon : MapElement, IMapPolygon, IMapPolygon2
public sealed class MapPolygon : MapElement, IMapPolygon, IMapPolygon2
Public NotInheritable Class MapPolygon Inherits MapElement Implements IMapPolygon, IMapPolygon2
Inheritance
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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

Initializes a new instance of the MapPolygon class.

public : MapPolygon()
public MapPolygon()
Public Sub New()
See Also

Properties

Dispatcher Dispatcher Dispatcher

Inherited from DependencyObject

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
Value
Color Color Color

The color to be used to fill the MapPolygon.

See Also

MapStyleSheetEntry MapStyleSheetEntry MapStyleSheetEntry

Inherited from MapElement

MapStyleSheetEntryProperty MapStyleSheetEntryProperty MapStyleSheetEntryProperty

Inherited from MapElement

MapStyleSheetEntryState MapStyleSheetEntryState MapStyleSheetEntryState

Inherited from MapElement

MapStyleSheetEntryStateProperty MapStyleSheetEntryStateProperty MapStyleSheetEntryStateProperty

Inherited from MapElement

MapTabIndex MapTabIndex MapTabIndex

Inherited from MapElement

MapTabIndexProperty MapTabIndexProperty MapTabIndexProperty

Inherited from MapElement

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
Value
Geopath Geopath Geopath

The collection of coordinates that define the MapPolygon shape.

See Also

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
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the Path dependency property.

See Also

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>
Value
IVector<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

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
Value
Color Color Color

The color to be used to draw the MapPolygon.

See Also

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
Value
Platform::Boolean bool bool

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

See Also

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
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the StrokeDashed dependency property.

See Also

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
Value
double double double

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

See Also

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
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the StrokeThickness dependency property.

See Also

Tag Tag Tag

Inherited from MapElement

TagProperty TagProperty TagProperty

Inherited from MapElement

Visible Visible Visible

Inherited from MapElement

VisibleProperty VisibleProperty VisibleProperty

Inherited from MapElement

ZIndex ZIndex ZIndex

Inherited from MapElement

ZIndexProperty ZIndexProperty ZIndexProperty

Inherited from MapElement

Methods

ClearValue(DependencyProperty) ClearValue(DependencyProperty) ClearValue(DependencyProperty)

Inherited from DependencyObject

GetAnimationBaseValue(DependencyProperty) GetAnimationBaseValue(DependencyProperty) GetAnimationBaseValue(DependencyProperty)

Inherited from DependencyObject

GetValue(DependencyProperty) GetValue(DependencyProperty) GetValue(DependencyProperty)

Inherited from DependencyObject

ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty)

Inherited from DependencyObject

RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback) RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback) RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback)

Inherited from DependencyObject

SetValue(DependencyProperty,Object) SetValue(DependencyProperty,Object) SetValue(DependencyProperty,Object)

Inherited from DependencyObject

UnregisterPropertyChangedCallback(DependencyProperty,Int64) UnregisterPropertyChangedCallback(DependencyProperty,Int64) UnregisterPropertyChangedCallback(DependencyProperty,Int64)

Inherited from DependencyObject

See Also