MapStyleSheet.ParseFromJson(String) MapStyleSheet.ParseFromJson(String) MapStyleSheet.ParseFromJson(String) MapStyleSheet.ParseFromJson(String) Method

Definition

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

public : static MapStyleSheet ParseFromJson(Platform::String styleAsJson)
static MapStyleSheet ParseFromJson(winrt::hstring styleAsJson) const;
public static MapStyleSheet ParseFromJson(String styleAsJson)
Public Shared Function ParseFromJson(styleAsJson As String) As MapStyleSheet

Parameters

styleAsJson
String String

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

Returns

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

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;