This project has moved and is read-only. For the latest updates, please go here.

Guidance: MapOverlay vs. MapPolyline, etc.

Mar 4, 2013 at 10:33 PM
I'm curious why MapGraticule derives from MapOverlay instead of just using MapPolylines and Points.

My real question is: If I have a complicated overlay with many geo-positioned XAML user controls which are changing dynamically, is there any advantage to deriving from MapOverlay instead of just implementing my own ObservableCollection derived class similar to SampleItems?

Is the main difference that MapOverlay derived objects are automatically connected in with ViewportChanged events, and is therefore more appropriate for overlay objects which are changing in real time as the map viewport changes?
Mar 5, 2013 at 5:03 PM
MapGraticule derives from MapOverlay because it does not only draw a set of lines, but also a set of labels at each graticule line crossing.

Although implemented differently in WPF and Silverlight/WinRT, the main purpose of MapOverlay is to define all the font and stroke related properties needed for drawing lines and text, and to care for layout and rendering updates when necessary.

In your scenario there is no advantage in using MapOverlay instead of a MapPanel, as the elements certainly won't use any of these properties.