答案 0 :(得分:1)
找到了答案。 我必须修改MapControl本身的MapStyleSheet-而不是MapIcon。尤其是样式表中的userPoint> stemAnchorRadiusScale。
答案 1 :(得分:0)
以下代码将为您的UWP地图设置样式,使其与Google Maps相似。您需要进行以下调整以适合您的应用。
string highwayColor = mode == MapController.MapMode.Satellite ? "\"strokeColor\": \"#B6F3D072\", \"fillColor\": \"#50FEF0AC\"" : "\"strokeColor\": \"#F3D072\", \"fillColor\": \"#FEF0AC\"";
string accessHighwayColor = mode == MapController.MapMode.Satellite ? "\"strokeColor\": \"#B6E3C072\", \"fillColor\": \"#50EEE0AC\"" : "\"strokeColor\": \"#E3C072\", \"fillColor\": \"#EEE0AC\"";
string jsonString = "{" +
"\"version\": \"1.*\"," +
"\"settings\": { \"landColor\": \"#ECEAE4\", \"fillColor\": \"#FFFFFF\" }," +
"\"elements\": {" +
"\"continent\": { \"labelScale\": 0.5 }," +
"\"political\": { \"borderStrokeColor\": \"#C2C0B9\", \"borderOutlineColor\": \"#00000000\" }," +
"\"userPoint\": { \"scale\": { \"value\": 1.0 }, \"stemAnchorRadiusScale\": { \"value\": 0 } }," +
"\"vegetation\": { \"fillColor\": { \"value\": \"#C2EDB1\" } }," +
"\"water\": { \"fillColor\": \"#AADAFF\" }," +
"\"drivingRoute\": { \"strokeColor\": \"#ffffffff\", \"fillColor\": \"#00b3fd\" }," +
"\"highway\": { " + highwayColor + " }," +
"\"controlledAccessHighway\": { " + accessHighwayColor + ", \"labelOutlineColor\": \"#E0C060\"}" +
"}" +
"}";
MapStyleSheet[] css = new MapStyleSheet[2];
css[0] = mode == MapController.MapMode.Satellite ? MapStyleSheet.AerialWithOverlay() : MapStyleSheet.RoadLight();
css[1] = MapStyleSheet.ParseFromJson(jsonString);
nativeMap.StyleSheet = MapStyleSheet.Combine(css);