MapStyleSheet.Combine(IIterable<MapStyleSheet>) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Combines the rules defined in two MapStyleSheet instances.
public:
static MapStyleSheet ^ Combine(IIterable<MapStyleSheet ^> ^ styleSheets);
static MapStyleSheet Combine(IIterable<MapStyleSheet> const& styleSheets);
public static MapStyleSheet Combine(IEnumerable<MapStyleSheet> styleSheets);
function combine(styleSheets)
Public Shared Function Combine (styleSheets As IEnumerable(Of MapStyleSheet)) As MapStyleSheet
Parameters
- styleSheets
The MapStyleSheet instances that you want to combine.
Returns
A MapStyleSheet instance that contains the combined rules defined in each MapStyleSheet instance that you passed to the styleSheets parameter.
Examples
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);
Remarks
If both MapStyleSheet instances define the same rule, the last instance will override the rule defined in the first instance.