1
votes

I'm fairly new to programming in XAML and I'm making a test application on windows phone 8.1 emulator with a MapControl.

I wanted to add a MapIcon to my map but the icon doesn't appear when the map is zoomed out. I've searched the internet and couldn't find anything regarding my problem.

I want my zoomlevel 12 and show the mapicon on that zoomlevel.

namespace TEST.APPLICATION
{
public partial class MapView : Page
{
    Geolocator geo = null;
    public MapView()
    {
        this.InitializeComponent();
        this.NavigationCacheMode = NavigationCacheMode.Required;
        HardwareButtons.BackPressed += HardwareButtons_BackPressed;
    }
    void HardwareButtons_BackPressed(object sender, BackPressedEventArgs e)
    {
        if (Frame.CanGoBack)
        {
            e.Handled = true;
            Frame.GoBack();
        }
    }

    protected override void OnNavigatedTo(NavigationEventArgs e)
    {
        map.Center = new Geopoint(new BasicGeoposition()
           {
              Latitude = 51.5856935784736,
              Longitude = 4.79448171225132
           });
        map.ZoomLevel = 12;

        displaySightings();
    }

    private void displaySightings()
    {
        MapIcon sighting1 = new MapIcon();
        sighting1.Location = new Geopoint(new BasicGeoposition()
        {
            Latitude = 51.5940,
            Longitude = 4.7795
        });
        //sighting1.NormalizedAnchorPoint = new Point(0.5, 1.0);
        sighting1.Title = "VVV";
        map.MapElements.Add(sighting1);
    }
}

Is there any way to make the MapIcon always visible?

1

1 Answers

2
votes

The MapIcon is not guaranteed to be shown. It may be hidden when it obscures other elements or labels on the map.

For some stupid reason, Microsoft thought that labels and other map elements should outrank map icons when rendering the display. So, if you're making an app displaying the locations of all the nearby Starbucks, the name of the high school across the street from the Starbucks is more important than the pushpin, according to them.

You'll need to render the pushpins using XAML instead.