-api-id | -api-type |
---|---|
M:Windows.UI.Xaml.Controls.Maps.MapStyleSheet.Combine(Windows.Foundation.Collections.IIterable{Windows.UI.Xaml.Controls.Maps.MapStyleSheet}) |
winrt method |
Combines the rules defined in two MapStyleSheet instances.
The MapStyleSheet instances that you want to combine.
A MapStyleSheet instance that contains the combined rules defined in each MapStyleSheet instance that you passed to the styleSheets parameter.
If both MapStyleSheet instances define the same rule, the last instance will override the rule defined in the first instance.
The following example combines rules from two MapStyleSheet instances into one MapStyleSheet instance.
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""
}
}
}";
string jsonString2 = @"{
""version"": ""1.*"",
""settings"":{
""landColor"":""#FFC8DD""
}
}";
MapStyleSheet myCustomStyleSheet = MapStyleSheet.ParseFromJson(jsonString);
MapStyleSheet myCustomStyleSheet2 = MapStyleSheet.ParseFromJson(jsonString2);
List<MapStyleSheet> myList = new List<MapStyleSheet>();
myList.Add(myCustomStyleSheet);
myList.Add(myCustomStyleSheet2);
myMap.StyleSheet = MapStyleSheet.Combine(myList);