Delen via


MapElement.MapStyleSheetEntry Property

Definition

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

public:
 property Platform::String ^ MapStyleSheetEntry { Platform::String ^ get(); void set(Platform::String ^ value); };
winrt::hstring MapStyleSheetEntry();

void MapStyleSheetEntry(winrt::hstring value);
public string MapStyleSheetEntry { get; set; }
var string = mapElement.mapStyleSheetEntry;
mapElement.mapStyleSheetEntry = string;
Public Property MapStyleSheetEntry As String

Property Value

String

Platform::String

winrt::hstring

The name of the entry in the map's style sheet that you'd like to apply to this MapElement. This name may be an existing map element (see remarks) that acts like an existing base map element of that type. Or the name may be an extension that is not used by the base map but is set by the style sheet creator and can be changed without affecting the base map (see the example code).

Windows requirements

Device family
Windows 10 Fall Creators Update (introduced in 10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v5.0)

Examples

string myStyleSheetJson = @"{""version"": ""1.*"",
  ""elements"":{
    ""foodPoint"":{
      ""iconColor"":""#FF000000""}},
  ""extensions"":{
    ""myNamespace"":{
      ""myFoodPoint"":{
        ""parent"":""foodPoint"",
        ""scale"":2}}}}";

myMap.StyleSheet = MapStyleSheet.ParseFromJson(myStyleSheetJson);
myMap.MapElements.Add(new MapIcon
{
  Location = new Geopoint(new BasicGeoposition { Latitude = 50, Longitude = -120 }),
  MapStyleSheetEntry = MapStyleSheetEntries.FoodPoint,
});
myMap.MapElements.Add(new MapIcon
{
  Location = new Geopoint(new BasicGeoposition { Latitude = 44, 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 and Map style sheet extensions.

Applies to