Windows 10 SDK: Bing Maps Control

With the pre-release of the Windows 10 SDK, I thought I'd have a go with it to see what's new, what's changed and how I can use this knowledge in my own apps.
 
The new map control, personally, has to be one of the most needed changes. Although there weren't any major issues with the Bing Maps SDK, the map control that it provided was not MVVM friendly. There were no dependency properties to bind to, making the implementation hard in an environment that works completely on the MVVM framework.
 
With the Universal Maps Control in the Windows 10 SDK preview, we see a major shift from the old Bing Maps control to this major MVVM friendly control that can be used with all the Windows platforms using the Universal App Platform (UAP) without any changes to code.
 
The MapControl is now part of the Windows.UI.Xaml.Controls namespace. If you've created a previous application that integrates with the old Bing Maps control, you'll find the new implementation minimal since the changes are only slight.
To get yourself started with adding a map to your XAML page, it's as easy as:
  1. <maps:MapControl x:Name="myMap" HorizontalAlignment="Left" /> 
This core map control has bindings for ZoomLevel, Heading, DesiredPitch and many more. However, before you get frustrated that there is no Items or ItemsSource binding, this is because the MapControl requires a child element for binding items to it. This is done as follows:
  1. <maps:MapControl x:Name="myMap" HorizontalAlignment="Left">    
  2.        <maps:MapItemsControl x:Name="MapItems" ItemsSource="{Binding}" />    
  3.  </maps:MapControl> 
The fun doesn't end there though. Since this is essentially a ListView, we have the ability to build up an ItemTemplate for the Map to render your items as:
  1. <maps:MapControl x:Name="myMap" HorizontalAlignment="Left">    
  2.    <maps:MapItemsControl x:Name="MapItems" ItemsSource="{Binding}">    
  3.       <maps:MapItemsControl.ItemTemplate>    
  4.          <DataTemplate>    
  5.             <Button x:Name="MapItemButton" Background="Transparent">    
  6.                <StackPanel>    
  7.                   <Border Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">    
  8.                      <TextBlock Text="{Binding Title}"/>    
  9.                   </Border>    
  10.                   <Image Source="{Binding ImageSourceUri}" maps:MapControl.Location="{Binding Location}">    
  11.                      <Image.Transitions>    
  12.                         <TransitionCollection>    
  13.                            <EntranceThemeTransition/>    
  14.                         </TransitionCollection>    
  15.                      </Image.Transitions>    
  16.                   </Image>    
  17.                </StackPanel>    
  18.             </Button>    
  19.          </DataTemplate>    
  20.       </maps:MapItemsControl.ItemTemplate>    
  21.    </maps:MapItemsControl>    
  22. </maps:MapControl> 
This makes it much easier for developers to create maps within their applications in an MVVM friendly way with the freedom to customise them as they wish.
 
There are some major improvements with the updates to the universal app model that will see more controls across WinRT being unified so that they can be used across multiple devices and multiple platforms.
 
Let me know in the comments below if you've had a go with the Windows 10 SDK preview and what you think of some of the changes you've found!

Up Next
    Ebook Download
    View all
    Learn
    View all