Search code examples
uwpapi-designuwp-maps

API Design - Purpose of MapItemsControl - why didn't UWP team just use MapControl?


I was wondering why does the MapItemsControl exists?

enter image description here

Why aren't these right on the MapControl instead?

What was the reason why UWP team had put these properties into a separate class instead of adding these right on the MapControl?

What's interesting (or confusing?) is you can basically add both MapItemsControl and an element to MapControl and it displays all:

<MapControl>
   <MapItemsControl ItemsSource="{Binding Items}" />
   <Border MapControl.Location="{Binding Location}" />
</MapControl>

Solution

  • I think this is to enable grouping of related map items. This enables you to take map items from multiple sources and display them. So if you had for example weather data, and traffic data, you would add two MapItemControl instances to your MapControl and bind the first one to some weather collection and another one to the traffic collection.

    Each type of data can also have its own custom ItemTemplate, which is also convenient.