MapElement MapElement MapElement MapElement Class

Definition

Some information relates to pre-released product which may be substantially modified before it’s commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Prerelease APIs are identified by a Prerelease label.

[Contains prerelease APIs.]
Represents an element displayed on a MapControl.

public : class MapElement : DependencyObject, IMapElement, IMapElement2
struct winrt::Windows::UI::Xaml::Controls::Maps::MapElement : DependencyObject, IMapElement, IMapElement2
public class MapElement : DependencyObject, IMapElement, IMapElement2
Public Class MapElement Inherits DependencyObject Implements IMapElement, IMapElement2
Inheritance
MapElementMapElementMapElementMapElement
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() MapElement()

Initializes a new instance of the MapElement class.

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

Properties

Dispatcher Dispatcher Dispatcher Dispatcher

Gets the CoreDispatcher that this object is associated with. The CoreDispatcher represents a facility that can access the DependencyObject on the UI thread even if the code is initiated by a non-UI thread.

(Inherited from DependencyObject)

IsEnabled IsEnabled IsEnabled IsEnabled

Prerelease. Indicates whether users can interact with the MapElement.

public : Platform::Boolean IsEnabled { get; set; }
bool IsEnabled(); void IsEnabled(bool isenabled);
public bool IsEnabled { get; set; }
Public ReadWrite Property IsEnabled As bool
Value
bool bool

true if users can interact with the MapElement; otherwise, false.

Additional features and requirements
Device family
Windows 10 Insider Preview (introduced v10.0.17095.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v6)

IsEnabledProperty IsEnabledProperty IsEnabledProperty IsEnabledProperty

Prerelease. Identifies the IsEnabled dependency property.

public : static DependencyProperty IsEnabledProperty { get; }
static DependencyProperty IsEnabledProperty();
public static DependencyProperty IsEnabledProperty { get; }
Public Static ReadOnly Property IsEnabledProperty As DependencyProperty
Value
DependencyProperty DependencyProperty

Identifier for the IsEnabled dependency property.

Additional features and requirements
Device family
Windows 10 Insider Preview (introduced v10.0.17095.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v6)

MapStyleSheetEntry 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; }
winrt::hstring MapStyleSheetEntry(); void MapStyleSheetEntry(winrt::hstring mapstylesheetentry);
public string MapStyleSheetEntry { get; set; }
Public ReadWrite Property MapStyleSheetEntry As string
Value
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 MapStyleSheetEntryProperty

Identifies for the MapStyleSheetEntry dependency property.

public : static DependencyProperty MapStyleSheetEntryProperty { get; }
static DependencyProperty MapStyleSheetEntryProperty();
public static DependencyProperty MapStyleSheetEntryProperty { get; }
Public Static ReadOnly Property MapStyleSheetEntryProperty As DependencyProperty
Value
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 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; }
winrt::hstring MapStyleSheetEntryState(); void MapStyleSheetEntryState(winrt::hstring mapstylesheetentrystate);
public string MapStyleSheetEntryState { get; set; }
Public ReadWrite Property MapStyleSheetEntryState As string
Value
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 MapStyleSheetEntryStateProperty

Identifies for the MapStyleSheetEntryState dependency property.

public : static DependencyProperty MapStyleSheetEntryStateProperty { get; }
static DependencyProperty MapStyleSheetEntryStateProperty();
public static DependencyProperty MapStyleSheetEntryStateProperty { get; }
Public Static ReadOnly Property MapStyleSheetEntryStateProperty As DependencyProperty
Value
DependencyProperty DependencyProperty

Identifier for the MapStyleSheetEntryState 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)

MapTabIndex 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; }
int32_t MapTabIndex(); void MapTabIndex(int32_t maptabindex);
public int MapTabIndex { get; set; }
Public ReadWrite Property MapTabIndex As int
Value
int int

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

MapTabIndexProperty MapTabIndexProperty MapTabIndexProperty MapTabIndexProperty

Identifies the MapTabIndex dependency property.

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

The identifier for the MapTabIndex dependency property.

Tag 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; }
winrt::Windows::Foundation::IInspectable Tag(); void Tag(winrt::Windows::Foundation::IInspectable tag);
public object Tag { get; set; }
Public ReadWrite Property Tag As object
Value
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 TagProperty

Identifies the Tag dependency property.

public : static DependencyProperty TagProperty { get; }
static DependencyProperty TagProperty();
public static DependencyProperty TagProperty { get; }
Public Static ReadOnly Property TagProperty As DependencyProperty
Value
DependencyProperty DependencyProperty

The Tag 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)

Visible Visible Visible Visible

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

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

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

VisibleProperty VisibleProperty VisibleProperty VisibleProperty

Identifies the Visible dependency property.

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

The identifier for the Visible dependency property.

ZIndex 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; }
int32_t ZIndex(); void ZIndex(int32_t zindex);
public int ZIndex { get; set; }
Public ReadWrite Property ZIndex As int
Value
int int

The z-index of the MapElement.

ZIndexProperty ZIndexProperty ZIndexProperty ZIndexProperty

Identifies the ZIndex dependency property.

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

The identifier for the ZIndex dependency property.

Methods

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

Clears the local value of a dependency property.

(Inherited from DependencyObject)

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

Returns any base value established for a dependency property, which would apply in cases where an animation is not active.

(Inherited from DependencyObject)

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

Returns the current effective value of a dependency property from a DependencyObject.

(Inherited from DependencyObject)

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

Returns the local value of a dependency property, if a local value is set.

(Inherited from DependencyObject)

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

Registers a notification function for listening to changes to a specific DependencyProperty on this DependencyObject instance.

(Inherited from DependencyObject)

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

Sets the local value of a dependency property on a DependencyObject.

(Inherited from DependencyObject)

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

Cancels a change notification that was previously registered by calling RegisterPropertyChangedCallback.

(Inherited from DependencyObject)

See Also