I'm generating map makers on a Bing Map. If I use the design-time Map Layer, which is added in XAML:
<bm:Map.Children>
<!-- Data Layer-->
<bm:MapLayer Name="DataLayer"/>
...it works great. However, I decided if I were plopping multiple different sets of markers on the map, I should put each set on its own map layer. So I added code like this:
private async void Gener8MapMarkers(List<PhotraxBaseData> _pbd, bool Cre8DynamicMapLayer)
{
. . .
if (Cre8DynamicMapLayer)
{
MapLayer newLayer = new MapLayer();
photraxMap.Children.Add(newLayer);
AddPushpin(loc, stuff, newLayer);
}
else
{
AddPushpin(loc, stuff, DataLayer);
}
. . .
But note how the pushpins show through the popup when I do this (only if I dynamically create MapLayer[s]):
Was adding subsequent sets to its own MapLayer a bad idea (should I just add everything to "DataLayer")?
If not, how can I use multiple MapLayers without having the pushpins show through the popup?
UPDATE
Yes, Marvin Smit's suggestion works, namely:
if (Cre8DynamicMapLayer)
{
MapLayer newLayer = new MapLayer();
//photraxMap.Children.Add(newLayer);
photraxMap.Children.Insert(0, newLayer);
AddPushpin(loc, stuff, newLayer);
}
His brother Rik is probably the better hoopster, but I doubt Rik can program his way out of a layup.