-api-id | -api-type |
---|---|
M:Windows.UI.Xaml.Controls.Maps.MapStyleSheet.ParseFromJson(System.String) |
winrt method |
Creates a stylesheet by parsing a JSON markup string that defines a set of custom rules.
A JSON markup string that defines a set of custom rules.
A MapStyleSheet that represents the rules defined in JSON markup string.
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;