Skip to content

Latest commit

 

History

History
57 lines (38 loc) · 1.37 KB

mapstylesheet_parsefromjson_1626148147.md

File metadata and controls

57 lines (38 loc) · 1.37 KB
-api-id -api-type
M:Windows.UI.Xaml.Controls.Maps.MapStyleSheet.ParseFromJson(System.String)
winrt method

Windows.UI.Xaml.Controls.Maps.MapStyleSheet.ParseFromJson

-description

Creates a stylesheet by parsing a JSON markup string that defines a set of custom rules.

-parameters

-param styleAsJson

A JSON markup string that defines a set of custom rules.

-returns

A MapStyleSheet that represents the rules defined in JSON markup string.

-remarks

-see-also

-examples

The following example uses the ParseFromJson method to create a MapStyleSheet and then applies that style sheet to the map control.

To learn more about the properties used in this example, see Map stylesheet reference.

string jsonString = @"{
  ""version"": ""1.*"",
  ""settings"":{
    ""rasterRegionsVisible"":true,
    ""spaceColor"":""#000000""
  },
  ""elements"":{
    ""majorRoad"":{
      ""labelColor"":""#490B7D"",
      ""labelScale"":1.5,
      ""font"": ""Comic Sans MS""
    }
  }
}";

MapStyleSheet myCustomStyleSheet = MapStyleSheet.ParseFromJson(jsonString);
myMap.StyleSheet = myCustomStyleSheet;