Double Buffering Win 10 Universal App Maps

412 Views Asked by At

I am having refresh issues with the Windows.UI.Xaml.Controls.Maps.MapControl. In the code below, Map is an instance of Windows.UI.Xaml.Controls.Maps.MapControl. I have mapPolygons which I am repetitively refreshing every ~40 ms, and there is a lot of artifacting/flashing in the map with the mapPolygons. Currently I am just adding MapPolygons to the Map.MapElements list and removing the old ones. Is there a way to enable double buffering for the map control in Windows 10 Universal apps? Else, what should I do to eliminate the artifacting/flashing?

Currently, I am adding the elements with the visibility set to false, then setting them visible, hiding the old elements, and then removing the old elements.

A snippet of the current update code:

polygon1.Visible = false;
polygon2.Visible = false;
Map.MapElements.Add(polygon1);
Map.MapElements.Add(polygon2);
polygon1.Visible = true;
polygon2.Visible = true;
for (int i = Map.MapElements.Count - 1 - 2; i >= 0; i--)  // Last two elements are new, remove others
{
    Map.MapElements[i].Visible = false;
}
for (int i = Map.MapElements.Count - 1 - 2; i >= 0; i--)  // Last two elements are new, remove others
{
    Map.MapElements.RemoveAt(i);
}
1

There are 1 best solutions below

0
On

Instead of deleting the polygons, try updating the location information. This will likely be faster for the map control. Note that the map control is written in native C++ and the XAML based properties of the polygon have to be converted into native code which has some overhead.