Mapping and Location in Windows Phone: Listing 2
XAML for the MapItemsControl, which is data bound to the Cities property.
- By Nick Randolph
- 06/22/2012
<maps:Map LogoVisibility="Collapsed"
CopyrightVisibility="Collapsed"
CredentialsProvider="{StaticResource Credentials}">
<maps:Pushpin x:Name="MyLocationPushPin" Content="Here I Am!"
Location="{Binding CurrentLocation}" />
<maps:MapItemsControl ItemsSource="{Binding Cities}">
<maps:MapItemsControl.Resources>
<DataTemplate x:Key="CityItemTemplate">
<maps:Pushpin Location="{Binding Location}">
<Grid MaxHeight="30" MaxWidth="80">
<Image Source="{Binding ImageUrl}" Stretch="UniformToFill"/>
<TextBlock Text="{Binding Name}" Foreground="Black" />
</Grid>
</maps:Pushpin>
</DataTemplate>
</maps:MapItemsControl.Resources>
<maps:MapItemsControl.ItemTemplate>
<StaticResource ResourceKey="CityItemTemplate"/>
</maps:MapItemsControl.ItemTemplate>
</maps:MapItemsControl>
</maps:Map>
About the Author
Nick Randolph runs Built to Roam, a consulting company that specializes in training, mentoring and assisting other companies build mobile applications. With a heritage in rich client applications for both the desktop and a variety of mobile platforms, Nick currently presents, writes and educates on the Windows Phone platform.