MapControl.StyleSheet MapControl.StyleSheet MapControl.StyleSheet MapControl.StyleSheet Property


Gets or sets an object that defines the style of the map control.

public : MapStyleSheet StyleSheet { get; set; }
MapStyleSheet StyleSheet();

void StyleSheet(MapStyleSheet stylesheet);
public MapStyleSheet StyleSheet { get; set; }
Public ReadWrite Property StyleSheet As MapStyleSheet

Property Value

An object that defines the style of the map control.

Additional features and requirements

Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)


The following example sets the StyleSheet property by using one of the provided styles through the static MapStyleSheet.RoadDark method.

  myMap.StyleSheet = MapStyleSheet.RoadDark();

Custom map styles can be defined in JSON and loaded through the MapStyleSheet.ParseFromJson method. They can optionally combined with a provided style.

A scalable way to do this is to create a file named MyStyle.json in the Assets folder of a UWP application. Make sure that its Build Action property is set to Content.

    "version": "1.*",

Add the following code to the application which has a MapControl named myMap.

Uri uri = new Uri("ms-appx:///Assets/MyStyle.json");
StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(uri);
string jsonText = await FileIO.ReadTextAsync(file);
myMap.StyleSheet = MapStyleSheet.Combine(new List<MapStyleSheet>