我在UWP项目中使用XAML-MapControl。
创建MapIcon时,图像浮动在地图上所需位置上方的固定偏移处,而不是直接在地图上,使用黑色线条将图标与地图连接起来,如下图所示:
我找不到删除此行或减小其大小的方法。
并没有其他MapElement类型似乎做我想要的,我想要MapIcon的确切行为,但没有这一行。
有没有办法做到这一点?
编辑:这是我创建MapIcons的方式:
var icon = new MapIcon
{
NormalizedAnchorPoint = new Point(0.5, 1),
Image = image,
Visible = true,
};
MapControl.MapElements.Add(icon);
Aaditi:
我尝试设置stylysheet,但它对我不起作用,可能是因为它只支持在比我目标更新的版本中:
MapControl.StyleSheet = MapStyleSheet.ParseFromJson("{ \"version\": \"1.*\", \"settings\": { }, \"elements\": { \"userPoint\": { \"stemAnchorRadiusScale\": 0, \"stemHeightScale\": 0 }}}");
您需要在地图样式表中将userPoint的stemAnchorRadiusScale和stemHeightScale属性设置为0。有关如何使用样式表的信息,请参阅此主题:https://docs.microsoft.com/en-us/windows/uwp/maps-and-location/elements-of-map-style-sheet。例如:
{
"version": "1.*",
"settings": {
},
"elements": {
"userPoint": {
"stemAnchorRadiusScale": 0,
"stemHeightScale": 0
}
}
}