3

I'm using a XAML-MapControl in a UWP-project.

When you create a MapIcon, the image is floating a fixed offset above the desired location on the map, instead of directly on the map, with a black line connecting the icon with the map, as you can see in this image:

enter image description here

I can't find a way to remove this line, or reduce its size.

And none of the other MapElement-types seem to do what I want, I want the exact behavior of the MapIcon, but without this line.

Is there a way to do that?

Edit: Here's how I create the MapIcons:

var icon = new MapIcon
{
    NormalizedAnchorPoint = new Point(0.5, 1),
    Image = image,
    Visible = true,
};
MapControl.MapElements.Add(icon);

Edit2:

I tried to set the stylysheet, but it does not work for me, probably because it's only supported in a version newer than the one I target:

MapControl.StyleSheet = MapStyleSheet.ParseFromJson("{ \"version\": \"1.*\", \"settings\": { }, \"elements\": { \"userPoint\": { \"stemAnchorRadiusScale\": 0, \"stemHeightScale\": 0 }}}");
Stef
  • 315
  • 3
  • 14

1 Answers1

2

You need to set the stemAnchorRadiusScale and stemHeightScale properties of userPoint to 0 in the map style sheet. See this topic for how to work with style sheets: https://learn.microsoft.com/en-us/windows/uwp/maps-and-location/elements-of-map-style-sheet. For example:

{
    "version": "1.*",
    "settings": {
    },
    "elements": {
        "userPoint": {
            "stemAnchorRadiusScale": 0,
            "stemHeightScale": 0
        }
    }
}
Duncan Lawler
  • 1,772
  • 8
  • 13
  • I tried what you said, but it didn't work. Did I do something wrong? I added it to the bottom of my question. – Stef Sep 13 '18 at 08:59
  • I noticed these properties are only supported from version 1713, and apparently we target 1629, so I guess that explains why it doesn't work for me. – Stef Sep 13 '18 at 09:35
  • That's correct - these properties will only work on Windows builds 1713 or later. You can set them on earlier builds, but they won't have any effect. You might look into the MapBillboard as an alternative. While the behavior is slightly different than MapIcon, it won't have a stem or anchor – Duncan Lawler Sep 13 '18 at 16:06