MapElement MapElement MapElement Class

Definition

Represents an element displayed on a MapControl.

public : class MapElement : DependencyObject, IMapElement, IMapElement2
public class MapElement : DependencyObject, IMapElement, IMapElement2
Public Class MapElement Inherits DependencyObject Implements IMapElement, IMapElement2
Inheritance
MapElementMapElementMapElement
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

MapElement() MapElement() MapElement()

Initializes a new instance of the MapElement class.

public : MapElement()
public MapElement()
Public Sub New()

Properties

Dispatcher Dispatcher Dispatcher

Inherited from DependencyObject

MapStyleSheetEntry MapStyleSheetEntry MapStyleSheetEntry

Gets or sets the name of an entry in the map's style sheet that you'd like to apply to this MapElement.

public : Platform::String MapStyleSheetEntry { get; set; }
public string MapStyleSheetEntry { get; set; }
Public ReadWrite Property MapStyleSheetEntry As string
Value
Platform::String string string

The name of the entry in the map's style sheet that you'd like to apply to this MapElement.

Additional features and requirements
Device family
Windows 10 Fall Creators Update (introduced v10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

Examples

string myStyleSheetJson = @"{""version"": ""1.*"",

  ""extensions"":{

    ""myNamespace"":{

      ""myFoodPoint"":{

        ""parent"":""foodPoint"",

        ""scale"":2}}}}";



this.map.StyleSheet = MapStyleSheet.ParseFromJson(myStyleSheetJson);
this.map.MapElements.Add(new MapIcon
{

  Location = new Geopoint(new BasicGeoposition { Latitude = 44, Longitude = -120 }),

  MapStyleSheetEntry = MapStyleSheetEntries.FoodPoint,

});
this.map.MapElements.Add(new MapIcon
{

  Location = new Geopoint(new BasicGeoposition { Latitude = 47, Longitude = -120 }),

  MapStyleSheetEntry = "myNamespace.myFoodPoint",

});

Remarks

Set this property to a string or to any of the property values available in the MapStyleSheetEntries class.

To learn more about entries in a map style sheet, see Map style sheet reference.

MapStyleSheetEntryProperty MapStyleSheetEntryProperty MapStyleSheetEntryProperty

Identifies for the MapStyleSheetEntry dependency property.

public : static DependencyProperty MapStyleSheetEntryProperty { get; }
public static DependencyProperty MapStyleSheetEntryProperty { get; }
Public Static ReadOnly Property MapStyleSheetEntryProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

Identifier for the MapStyleSheetEntry dependency property.

Additional features and requirements
Device family
Windows 10 Fall Creators Update (introduced v10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

MapStyleSheetEntryState MapStyleSheetEntryState MapStyleSheetEntryState

Gets or sets the name of the state of this MapElement. If the style sheet defines a style for that state, that style is applied to this element. Values defined in the style sheet for the state override values defined in the MapStyleSheetEntry.

public : Platform::String MapStyleSheetEntryState { get; set; }
public string MapStyleSheetEntryState { get; set; }
Public ReadWrite Property MapStyleSheetEntryState As string
Value
Platform::String string string

The name of the state of this MapElement.

Additional features and requirements
Device family
Windows 10 Fall Creators Update (introduced v10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

Examples

string myStyleSheetJson = @"{""version"": ""1.*"",

  ""extensions"":{

    ""myNamespace"":{

      ""myState"":{

        ""fillColor"":""#FF0000""}}}}";



this.map.StyleSheet = MapStyleSheet.ParseFromJson(myStyleSheetJson);
this.map.MapElements.Add(new MapIcon
{

  Location = new Geopoint(new BasicGeoposition { Latitude = 44, Longitude = -120 }),

  MapStyleSheetEntry = MapStyleSheetEntries.FoodPoint,

  MapStyleSheetEntryState = MapStyleSheetEntryStates.Selected,

});
this.map.MapElements.Add(new MapIcon
{

  Location = new Geopoint(new BasicGeoposition { Latitude = 47, Longitude = -120 }),

  MapStyleSheetEntry = MapStyleSheetEntries.FoodPoint,

  MapStyleSheetEntryState = "myNamespace.myState",

});

Remarks

Set this property to a string or to any of the property values available in the MapStyleSheetEntryStates class.

To learn more about entries in a map style sheet, see Map style sheet reference.

MapStyleSheetEntryStateProperty MapStyleSheetEntryStateProperty MapStyleSheetEntryStateProperty

Identifies for the MapStyleSheetEntryState dependency property.

public : static DependencyProperty MapStyleSheetEntryStateProperty { get; }
public static DependencyProperty MapStyleSheetEntryStateProperty { get; }
Public Static ReadOnly Property MapStyleSheetEntryStateProperty As DependencyProperty
Additional features and requirements
Device family
Windows 10 Fall Creators Update (introduced v10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

MapTabIndex MapTabIndex MapTabIndex

Gets or sets a value that determines the order in which elements of the MapControl receive focus when the user navigates through those elements by pressing the Tab key.

public : int MapTabIndex { get; set; }
public int MapTabIndex { get; set; }
Public ReadWrite Property MapTabIndex As int
Value
int int int

A value that determines the order of logical navigation across elements in a MapControl.

MapTabIndexProperty MapTabIndexProperty MapTabIndexProperty

Identifies the MapTabIndex dependency property.

public : static DependencyProperty MapTabIndexProperty { get; }
public static DependencyProperty MapTabIndexProperty { get; }
Public Static ReadOnly Property MapTabIndexProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the MapTabIndex dependency property.

Tag Tag Tag

Gets or sets an arbitrary object value that can be used to store custom information about this object.

public : Platform::Object Tag { get; set; }
public object Tag { get; set; }
Public ReadWrite Property Tag As object
Value
Platform::Object object object

An arbitrary object value that can be used to store custom information about this object.

Additional features and requirements
Device family
Windows 10 Fall Creators Update (introduced v10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

TagProperty TagProperty TagProperty

Identifies the Tag dependency property.

public : static DependencyProperty TagProperty { get; }
public static DependencyProperty TagProperty { get; }
Public Static ReadOnly Property TagProperty As DependencyProperty
Additional features and requirements
Device family
Windows 10 Fall Creators Update (introduced v10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

Visible Visible Visible

Gets or sets a value that indicates whether the MapElement is visible on the MapControl.

public : Platform::Boolean Visible { get; set; }
public bool Visible { get; set; }
Public ReadWrite Property Visible As bool
Value
Platform::Boolean bool bool

true if the MapElement is visible on the MapControl; otherwise, false.

VisibleProperty VisibleProperty VisibleProperty

Identifies the Visible dependency property.

public : static DependencyProperty VisibleProperty { get; }
public static DependencyProperty VisibleProperty { get; }
Public Static ReadOnly Property VisibleProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the Visible dependency property.

ZIndex ZIndex ZIndex

Gets or sets the z-index of the MapElement. A MapElement with a higher z-index is displayed on top of a MapElement with a lower z-index.

public : int ZIndex { get; set; }
public int ZIndex { get; set; }
Public ReadWrite Property ZIndex As int
Value
int int int

The z-index of the MapElement.

ZIndexProperty ZIndexProperty ZIndexProperty

Identifies the ZIndex dependency property.

public : static DependencyProperty ZIndexProperty { get; }
public static DependencyProperty ZIndexProperty { get; }
Public Static ReadOnly Property ZIndexProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the ZIndex dependency property.

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